Solved

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

Posted on 2006-07-09
5
556 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Nyee,

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

Bob
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now