[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

FolderBrowserDialog Missing TreeView Control

dennis.vansickle

10/29/2003 7:03:00 PM

I am having a problem with the FolderBrowserDialog control in my
application. When I call the ShowDialog() implementation the dialog
appears and the buttons (OK, Cancel, Add Folder) appear but the
Treeview control is missing. VEry unhelpful for navigating my system
to find a folder.


I've noticed that the problem only occurs when I have my main()
attributed with [MTAThread]. If I change the attribute to [STAThread]
then it works as expected. Does anyone know how to specify work
around this issue?


Any suggestions would be greatly appreciated.

Thanks.

Dennis
3 Answers

v-yiy

10/30/2003 2:03:00 AM

0

Hi Dennis,
The FolderBrowserDialog class is a wrapper of the FolderBrowerDialog in the
Shell. It is an OLE dialog, which uses a STA thread apartment model, so if
you call it from a MTA model you will meet some strange problems. You
should keep the STAThread attribute if you need to call this class.
Does this answer your question?
If you still have questions on this issue, please be free to post it on the
group.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: dennis.vansickle@dfrc.nasa.gov (Dennis)
| Newsgroups: microsoft.public.dotnet.framework.sdk
| Subject: FolderBrowserDialog Missing TreeView Control
| Date: 29 Oct 2003 11:02:58 -0800
| Organization: http://groups....
| Lines: 18
| Message-ID: <2b37613.0310291102.27eb346f@posting.google.com>
| NNTP-Posting-Host: 130.134.81.15
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1067454178 17840 127.0.0.1 (29 Oct 2003
19:02:58 GMT)
| X-Complaints-To: groups-abuse@google.com
| NNTP-Posting-Date: Wed, 29 Oct 2003 19:02:58 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
stnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.sdk:7999
| X-Tomcat-NG: microsoft.public.dotnet.framework.sdk
|
| I am having a problem with the FolderBrowserDialog control in my
| application. When I call the ShowDialog() implementation the dialog
| appears and the buttons (OK, Cancel, Add Folder) appear but the
| Treeview control is missing. VEry unhelpful for navigating my system
| to find a folder.
|
|
| I've noticed that the problem only occurs when I have my main()
| attributed with [MTAThread]. If I change the attribute to [STAThread]
| then it works as expected. Does anyone know how to specify work
| around this issue?
|
|
| Any suggestions would be greatly appreciated.
|
| Thanks.
|
| Dennis
|

=?Utf-8?B?cm9kY2hhcg==?=

10/30/2003 3:56:00 PM

0

Thank you for posting a reply.

I don't recall reading in the documentation that it is
limited to STAThread--maybe, as a suggestion, it should
be added in.

Secondly, I guess I don't understand the MTA versus STA
usage. My application uses multiple threads and interop
with the user32.dll, but no COM interop. Could you
please explain the MTA usage or point me to a link that
could help me understand better?


Thank you.


Dennis
>-----Original Message-----
>Hi Dennis,
>The FolderBrowserDialog class is a wrapper of the
FolderBrowerDialog in the
>Shell. It is an OLE dialog, which uses a STA thread
apartment model, so if
>you call it from a MTA model you will meet some strange
problems. You
>should keep the STAThread attribute if you need to call
this class.
>Does this answer your question?
>If you still have questions on this issue, please be
free to post it on the
>group.

Dennis

10/30/2003 4:44:00 PM

0

Please disregard. I went back into the MSDN
documentation and read up on the MTAThread and STAThread
attributes. I found what I was missing. The fact that
I'm not actually using COM Interop is what is causing me
no effect with that attribute.


Thank you for responding.


Dennis