473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Open file dialog not showing network locations

I am doing setup project in VS 2008. I used custom action to select file from local drives. On the button click of custom action form, I am launching Open file dialog as

ofdGetNetPath.ShowDialog
When I run the setup on Vista, and click the button to open the openFileDialog, it hanged, form becomes non responsive and I have to cancel the setup.

on debugging I got following 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 in it. This exception is only raised if a debugger is attached to the process."

so I used the following code:
Expand|Select|Wrap|Line Numbers
  1. Dim ofdThread As Thread
  2.  
  3. ofdThread = New Thread(New ThreadStart(AddressOf ShowOpenFileDialog))
  4.  
  5. ofdThread.SetApartmentState(ApartmentState.STA)
  6.  
  7. ofdThread.Start()
  8.  
  9. Private Sub ShowOpenFileDialog()
  10.           Me.ofdGetNetPath.ShowDialog()
  11. End Sub
now on button click, OpenFileDialog is shown but it is not showing Mapped drive or Network location... what should I need to do to show the mapped drive or network locations?
Jun 3 '09 #1
2 3413
Frinavale
9,735 Expert Mod 8TB
This isn't making sense to me.

Why are you using an OpenFileDialog in a thread to begin with?
Jun 3 '09 #2
I have to use thread becouse if I directly launch the open file dialog (ofdGetNetPath.ShowDialog) in the custom action, it gives following 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 in it. This exception is only raised if a debugger is attached to the process."
Jun 4 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bernavich2004 | last post by:
Ok I am going nuts. This problem ONLY happens when I use a Microsoft Office 2003 product like word, or .NET development IDE. WHen I use the Open file dialog and click on a folder to drill down,...
2
by: nissiml | last post by:
hi, i'm trying to open a asp.net web page that list files from a Windows application like winword and select a file from it . what do i have to do to make it happen, is it simple ? Thanks in...
9
by: Amit D.Shinde | last post by:
How to enable user for selecting only folders and not the files with the Open File Dialog. i.e. I want only path of the selected folder is to be returned by Open File Dialog. i.e Open File Dialog...
0
by: Me | last post by:
I have an application that has a text box. At the end on the text box is the standard elypsis (command button) for launching the Open File Dialog box. I want the user to select a certain executable...
3
by: The ants are driving me crazy | last post by:
The open file dialog control in Windows forms has an "Open" button. Is there a way to change the text of the button to something other than "Open"?
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
1
by: SAL | last post by:
Hello, Has anyone use the Open File Dialog Box in ASP.net? I know you can add the HTML File Field control to your ASP page and it will open the File Dialog Box for you. However, I would like...
4
by: nightscorpion | last post by:
Hello Gurus, i implemented the OpenFileDialog in my Windows Form Applications and it worked perfectly fine.However when it was run on a remote desktop i got the below error . ...
2
by: pandehrushikesh | last post by:
I am using Vista Business SP1. When I run some application "As Administrator" (even if I am administrator), Open file dialog does not show the mapped drive or network locations. any Idea???
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.