i m trying to browse a folder using folderbrowserdialoge and got this error
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Threading.ThreadStateException: 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.
Source Error:
Line 64: ' If the user clicks theFolderBrowser's OK button..
Line 65:
Line 66: If theFolderBrowser.ShowDialog = System.Windows.Forms.DialogResult.OK Then Line 67:
Line 68: ' Set the FolderChoiceTextBox's Text to theFolderBrowserDialog's
|
Source File: C:\Users\npkr\Documents\Visual Studio 2008\Projects\bachao\bachao\Default.aspx.vb Line: 66
Stack Trace:
[ThreadStateException: 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.]
System.Windows.Forms.FolderBrowserDialog.RunDialog(IntPtr hWndOwner) +2000137
System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner) +538
System.Windows.Forms.CommonDialog.ShowDialog() +6
bachao._Default.Button1_Click(Object sender, EventArgs e) in C:\Users\npkr\Documents\Visual Studio 2008\Projects\bachao\bachao\Default.aspx.vb:66
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
|
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016