OPENFILEDIALOG ??

D

De kessé

Im trying to do this from ASP.NET and it does not work.

Dim ofd As New OpenFileDialog

Openfiledialog is not there.

But I can find it in the object browser.

In my web config i can see this
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>

What am i missing to use that openfiledialog?
 
D

De kessé

ok I found it but I am getting a thread error on showdialog

error msg:

"Current thread must be set to single thread apartment (STA) mode before OLE
calls can be made. Ensure that your Main function has STAThreadAttribute
marked on it. This exception is only raised if a debugger is attached to the
process."

code:

Dim ofd As New Windows.Forms.OpenFileDialog

ofd.Filter = "Text files (*.txt)|*.txt|" & "All files|*.*"

If ofd.ShowDialog() Then


End If
 
E

Edwin Knoppert

This is ASP.NET !!

De kessé said:
ok I found it but I am getting a thread error on showdialog

error msg:

"Current thread must be set to single thread apartment (STA) mode before
OLE calls can be made. Ensure that your Main function has
STAThreadAttribute marked on it. This exception is only raised if a
debugger is attached to the process."

code:

Dim ofd As New Windows.Forms.OpenFileDialog

ofd.Filter = "Text files (*.txt)|*.txt|" & "All files|*.*"

If ofd.ShowDialog() Then


End If
 
P

Patrice

Keep in mind that your code runs server side i.e. at best it would open this
server side where it is useless...

If your goal is to upload a file use the htmlInputFile control (or the
FileUpload control).

If this is not an ASP.NET application, try a Windows Forms group.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,100
Latest member
MelodeeFaj
Top