Click here to Skip to main content
15,919,479 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Thomas Stockwell26-Apr-08 18:19
professionalThomas Stockwell26-Apr-08 18:19 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Marc Clifton27-Apr-08 3:40
mvaMarc Clifton27-Apr-08 3:40 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Giorgi Dalakishvili26-Apr-08 23:49
mentorGiorgi Dalakishvili26-Apr-08 23:49 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
#realJSOP27-Apr-08 3:27
professional#realJSOP27-Apr-08 3:27 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Marc Clifton27-Apr-08 3:38
mvaMarc Clifton27-Apr-08 3:38 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Thomas Stockwell27-Apr-08 3:46
professionalThomas Stockwell27-Apr-08 3:46 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Marc Clifton27-Apr-08 4:19
mvaMarc Clifton27-Apr-08 4:19 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Mark Salsbery27-Apr-08 10:25
Mark Salsbery27-Apr-08 10:25 
This is probably totally unrelated to your situation, but I'll
throw it out there just in case...

I just tried your code from C++/CLI on Vista...
int _tmain()
{
	OpenFileDialog ^ofd = gcnew OpenFileDialog();
	ofd->RestoreDirectory = true;
	ofd->CheckFileExists = true;
	ofd->Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
	ofd->Title = "Load Report";
	DialogResult res = ofd->ShowDialog();
...

...and got an exception "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..."

A quick change to this made it work fine:
[STAThreadAttribute]
int _tmain()
{
	OpenFileDialog ^ofd = gcnew OpenFileDialog();
	ofd->RestoreDirectory = true;
	ofd->CheckFileExists = true;
	ofd->Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
	ofd->Title = "Load Report";
	DialogResult res = ofd->ShowDialog();
...

Good luck Smile | :)
Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Marc Clifton27-Apr-08 11:17
mvaMarc Clifton27-Apr-08 11:17 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
S. Senthil Kumar27-Apr-08 15:10
S. Senthil Kumar27-Apr-08 15:10 
GeneralRe: OpenFileDialog and SaveFileDialog crashing Pin
Marc Clifton28-Apr-08 0:44
mvaMarc Clifton28-Apr-08 0:44 
QuestionDrag & Drop from Windows Explorer into IE using ActiveX Pin
philster24-Apr-08 19:04
philster24-Apr-08 19:04 
GeneralApplication as both WS client and server Pin
sandersja23-Apr-08 10:31
sandersja23-Apr-08 10:31 
GeneralRe: Application as both WS client and server Pin
Colin Angus Mackay23-Apr-08 12:20
Colin Angus Mackay23-Apr-08 12:20 
GeneralRe: Application as both WS client and server Pin
#realJSOP27-Apr-08 3:29
professional#realJSOP27-Apr-08 3:29 
GeneralService Oriented Architecture Pin
ctrlnick22-Apr-08 10:33
ctrlnick22-Apr-08 10:33 
GeneralRe: Service Oriented Architecture Pin
led mike22-Apr-08 11:08
led mike22-Apr-08 11:08 
GeneralRe: Service Oriented Architecture Pin
#realJSOP27-Apr-08 3:30
professional#realJSOP27-Apr-08 3:30 
GeneralSystem.ServiceProcess Pin
ffowler22-Apr-08 5:37
ffowler22-Apr-08 5:37 
GeneralRe: System.ServiceProcess Pin
Mark Salsbery22-Apr-08 6:17
Mark Salsbery22-Apr-08 6:17 
GeneralRe: System.ServiceProcess Pin
ffowler22-Apr-08 7:12
ffowler22-Apr-08 7:12 
GeneralXQuery Pin
Gktony21-Apr-08 23:33
Gktony21-Apr-08 23:33 
GeneralRe: XQuery Pin
Christian Graus23-Apr-08 12:26
protectorChristian Graus23-Apr-08 12:26 
GeneralRe: XQuery Pin
Gktony23-Apr-08 22:00
Gktony23-Apr-08 22:00 
GeneralRe: XQuery Pin
Christian Graus23-Apr-08 22:02
protectorChristian Graus23-Apr-08 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.