1. User Mode Thread vs Kernel Mode Thread
2. Current thread must be set to single thread apartment (STA)
Hi
I have just upgraded a vb.net 2003 project to 2005. I get an error when
trying to access a FolderBrowserDialog as follows
Private Sub Button1_Click_2(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
FolderBrowserDialog1.Description = "Please select a location for
your web pages."
'Default to the c drive if it exists
If Directory.Exists("c:\") = True Then
FolderBrowserDialog1.SelectedPath = "c:\"
Else
FolderBrowserDialog1.SelectedPath = ""
End If
FolderBrowserDialog1.ShowDialog()
end sub
The error I get is:
"the 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 de *** is attached to the
process."
So i created a class 'clsStartup' containing a main procedure:
Public Class clsStartup
<STAThread()> _
Shared Sub Main()
' Declare a variable named frm1 of type Form1.
Dim frm1 As frmWSGWebSiteLocationUpdate
' Instantiate (create) a new Form1 object and assign
' it to variable frm1.
frm1 = New frmWSGWebSiteLocationUpdate()
' Call the Application class' Run method
' passing it the Form1 object created above.
Application.Run(frmWSGWebSiteLocationUpdate)
End Sub
End Class
And set the startup object to be clsStartup.
But I still get the same message.
Can anyone help me please?
Regards,
Steve.
3. Single-threaded Thread Pool for debugging purposes ?
4. Single-thread delegate vs multi-thread delegate
5. Mixing single threaded and multi-threaded application
6. Transforming single-thread malloc impls into lock-free multi-thread ones...
7. single threaded vs multi threaded programming
8. Single thread vb6 app and multi threaded processes
9. [ace-users] How does thread-per-connection work with single threaded child POA
10. Can single-threaded gcc be used for writing multi-threaded apps?
11. single threaded vs. multi threaded
12. Threading.Monitor.Enter that doesn't /quite/ block the thread
13. Multi threaded processor comparison with single thread processor
14. How to stop a thread among several threads created with a single Runnable ?
15. Does two single threaded child POAs share the same thread?