Solved

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

Posted on 2006-07-09
5
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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