Can not see the folder.

C

ca___t

hi guys

I have an windows form application that with one button and one
folderBrowserDialog Control in this form.

I use folderBrowserDialog control to open a folder Browser in this
windows form that can appear.

but when I set the BackgroundImage property of windows to
System.Drawing.bitmap that I set a bmp image to the background.when I click
the button,folder Browser appear wrong,can not see folder ,only can see
"OK,Cancel" button

how to resolve this .

thanks a lot
jiangyh
 
C

ca___t

hi joeycalisay:

This question is ok.thanks for you help.


joeycalisay said:
Be sure to have the
[STAThread] attribute for your static main

ca___t said:
hi guys

I have an windows form application that with one button and one
folderBrowserDialog Control in this form.

I use folderBrowserDialog control to open a folder Browser in this
windows form that can appear.

but when I set the BackgroundImage property of windows to
System.Drawing.bitmap that I set a bmp image to the background.when I click
the button,folder Browser appear wrong,can not see folder ,only can see
"OK,Cancel" button

how to resolve this .

thanks a lot
jiangyh
 
C

ca___t

thanks for help

But I have another question about what's means STAThread.



joeycalisay said:
Be sure to have the
[STAThread] attribute for your static main

ca___t said:
hi guys

I have an windows form application that with one button and one
folderBrowserDialog Control in this form.

I use folderBrowserDialog control to open a folder Browser in this
windows form that can appear.

but when I set the BackgroundImage property of windows to
System.Drawing.bitmap that I set a bmp image to the background.when I click
the button,folder Browser appear wrong,can not see folder ,only can see
"OK,Cancel" button

how to resolve this .

thanks a lot
jiangyh
 
J

joeycalisay

Intellisense says: Indicates that the COM Threading model for an application
is single-threaded apartment
I've heard before that FolderBrowserDialog conflicts with a multithreaded
application (something like this), so it messes up if it's not single
threaded. I didn't bother to ask why before...

ca___t said:
thanks for help

But I have another question about what's means STAThread.



joeycalisay said:
Be sure to have the
[STAThread] attribute for your static main

ca___t said:
hi guys

I have an windows form application that with one button and one
folderBrowserDialog Control in this form.

I use folderBrowserDialog control to open a folder Browser in this
windows form that can appear.

but when I set the BackgroundImage property of windows to
System.Drawing.bitmap that I set a bmp image to the background.when I click
the button,folder Browser appear wrong,can not see folder ,only can see
"OK,Cancel" button

how to resolve this .

thanks a lot
jiangyh
 
H

Herfried K. Wagner [MVP]

ca___t said:
but when I set the BackgroundImage property of windows to
System.Drawing.bitmap that I set a bmp image to the background.when I
click
the button,folder Browser appear wrong,can not see folder ,only can see
"OK,Cancel" button

Make sure there is no 'MTAThread' attribute specified on your 'void Main'.
Instead use 'STAThread', which ist the default and doesn't need to be
specified, at least in VB.NET.
 
V

Vivek Srivastav

My problem is similar, however I have a .Net Installer Class Library, where
I need to open a folderbrowser dialog for the user to specify a directory. I
have put [STAThread] attribute around the event which creates the
FolderBrowserDialog but it still seems blank with only the description, ok
and cancel button.
I don't know what i am doing wrong!
 
H

Herfried K. Wagner [MVP]

Vivek Srivastav said:
My problem is similar, however I have a .Net Installer Class Library,
where I need to open a folderbrowser dialog

Try something like 'Thread.CurrentThread.ApartmentState =
ApartmentState.STA' before using the 'FolderBrowserDialog'...
 
V

Vivek Srivastav

No Luck.

Herfried K. Wagner said:
Try something like 'Thread.CurrentThread.ApartmentState =
ApartmentState.STA' before using the 'FolderBrowserDialog'...
 

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

Top