Solved

console application need call open dialog box to let the user select a file .. Is that possible??

Posted on 2006-07-09
5
562 Views
Last Modified: 2008-02-01
I am thinking of developing a console application and my dilema right now is how to call the open dialog box from a console application, once after user select a file, i need do some data manipulation based on the user selected filename, i know if i use a windows form applicaton, the above task can be achieved freaking easy, but it was very unfortunate that
my boss asked to develoe a console application to achieve the above task..

Is that possible???

 
0
Comment
Question by:nyee84
  • 3
  • 2
5 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17070273
Sure, just do this:

1) Add a reference to System.Windows.Forms.dll to the project

2) Use some code similar to this:

Imports System.Windows.Forms

Module Module1

  Sub Main()

    Dim dialog As New OpenFileDialog

    dialog.ShowDialog()

  End Sub

End Module

Bob
0
 

Author Comment

by:nyee84
ID: 17070542
I got an error message when adding reference to windows.forms.dll

A referece to System.Windows.Forms.dll could not be added. Converting the type library to a .NET assembly failed. Type Library System_Windows_Forms was exported from a CLR assembly and cannot be re-imported as CLR assembly.

What does it mean>> How to resolve it?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17072186
Whoa! Where are getting that from?  What tab were you on on the Add Reference dialog?  Were you on the COM tab?

Bob
0
 

Author Comment

by:nyee84
ID: 17078512
Hi Bob,

I have selected COM tab and selected " System.Windows.Forms.dll" and when i tried click ok i have encountered the above mentioned error message..

Nyee
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17080650
Nyee,

That's what I thought.  System.Windows.Forms.dll is on the .NET tab, not the COM tab.

Bob
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question