473,289 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Using a Windows Application to output console messages

I currently have a C# windows Application . I would like this App to
work through an command line interface also. I would like to specify
command line params, which should start the app and process using the
params.
However as a starting step I am trying to print the command line args
to the console ( form the windows application) and that is not
working.

1.Is it possible to print to the console in a windows application ? If
so how would I do this.
2. Is it possible to suppress the GUI (form) of a c# windows
application and allow the processing to occur as though it is a console

app ?
Thanks in advance.

Mar 8 '06 #1
1 3771
An easy way to accomplish this is to start with a console application.
Inside Main, create an instance of a class derived from
System.Windows.Forms.Form. You now have two options:

1. You can start your form object as a windows app by calling
Application.Run(<instance of your form class>)
2. You can choose not to display the GUI and simply use the public members
of your form object directly.

Typically, whether you display the GUI depends on the parameters passed on
the command line. You also have access to the console through the underlying
console app. You can easily utilize a callback delegate to have the windows
application pass information to the console app and write this to the
console window.

I hope this helps.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"lavu" <th******@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I currently have a C# windows Application . I would like this App to
work through an command line interface also. I would like to specify
command line params, which should start the app and process using the
params.
However as a starting step I am trying to print the command line args
to the console ( form the windows application) and that is not
working.

1.Is it possible to print to the console in a windows application ? If
so how would I do this.
2. Is it possible to suppress the GUI (form) of a c# windows
application and allow the processing to occur as though it is a console

app ?
Thanks in advance.

Mar 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
6
by: Max | last post by:
Hi All, I am developing an application that needs to run in one of two modes: 1. If No command line param is provided the application should run as Window form. 2. If command line param is...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
2
by: Boba | last post by:
Hi, I'm programming a WinForm application. I would like to enter commands that will send output that will help me to locate bugs in the future. I know that there is a way to send output by...
6
by: Mark Allison | last post by:
Hi, I have an application that I want to be to run in Console mode and GUI mode. If no params are entered, I want the GUI fired up, if params are entered, then go into console mode. I believe...
1
by: Dan Kelley | last post by:
I have 2 projects - 1 Winform project that sends Udp messages using the UdpClient class when a button is clicked, and a Console application that listens for these Udp messages. If I try to use...
1
by: Teis Draiby | last post by:
I am working on a Win32 program with an additional console window to output messages. I also want to type commands in the console window. Is there any common way to achieve that? For example how...
0
by: nmsreddi | last post by:
Hi friends I am working on c#.net . i am developing a windows application using c# 2003 aim of my application is sending and receiving sms using GSM modem. for this i am using AxMscomm...
4
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.