473,508 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Starting a C# app without a form

I have developed a mini-app that does some routine maintenance tasks on
my Outlook 2003 files.

For the dev process, I ran a form with just a GO button on it but now
that the app is ready for testing, I want to run it without any user
interface.

Up until now, I have started it with:
Application.Run(new Form1());

but now I don't want a form to load; I have searched the doc but I
cannot find out how to start the app without loading a form.

What I really want to do is to instantiate an object of a type from one
of my classes and then execute one of its methods: something like:

ClassOutlook objOL = new ClassOutlook();
objOL.SaveOutlookAttachments();

anyone out there know how this can be done?

Cheers

Paul BJ
Nov 17 '05 #1
6 1373
If you use the following:

ClassOutlook objOL = new ClassOutlook();
objOL.SaveOutlookAttachments()*;

instead of Application.Run(new Form1()), your app will exit as soon as
SaveOutlookAttachments is called. Is that what you want?

-------
Ajay Kalra
aj*******@yahoo.com

Nov 17 '05 #2
Ajay Kalra wrote:
If you use the following:

ClassOutlook objOL = new ClassOutlook();
objOL.SaveOutlookAttachments()*;

instead of Application.Run(new Form1()), your app will exit as soon as
SaveOutlookAttachments is called. Is that what you want?

-------
Ajay Kalra
aj*******@yahoo.com

I don't understand....do I still call

Application.Run() ?

I want objOL.SaveOutlookAttachments() to run ...then it can exit...is that what you meant?

What I want is
ClassOutlook objOL = new ClassOutlook();
objOL.SaveOutlookAttachments()*

to run when the app is started...if there is no other code after
objOL.SaveOutlookAttachments() then yes it will exit.
Cheers

Paul BJ
*
Nov 17 '05 #3
VJ
Paul.. are you looking to do like a Service or Console application.. a few
options.. These type of projects will not have a UI interface by default &
you can execute code & exit application without showing UI.

VJ

"Paul BJ" <pa****@skynet.be> wrote in message news:42********@news.vo.lu...
Ajay Kalra wrote:
If you use the following:

ClassOutlook objOL = new ClassOutlook();
objOL.SaveOutlookAttachments()*;

instead of Application.Run(new Form1()), your app will exit as soon as
SaveOutlookAttachments is called. Is that what you want?

-------
Ajay Kalra
aj*******@yahoo.com

I don't understand....do I still call

Application.Run() ?

I want objOL.SaveOutlookAttachments() to run ...then it can exit...is that
what you meant?

What I want is ClassOutlook objOL = new ClassOutlook();
objOL.SaveOutlookAttachments()*

to run when the app is started...if there is no other code after
objOL.SaveOutlookAttachments() then yes it will exit.
Cheers

Paul BJ
*

Nov 17 '05 #4
Paul BJ wrote:

I want objOL.SaveOutlookAttachments() to run ...then it can exit...is
that what you meant?


Then simply have a Console application. It will execute your statements and
exit as you want.
--
Ajay Kalra [MVP - VC++]
aj*******@yahoo.com

Nov 17 '05 #5
"Ajay Kalra" <aj*******@yahoo.com> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
Then simply have a Console application. It will execute your statements and exit as you want.


Not exactly. He has a Windows application which never creates a window,
which is not a Console app (because it also does not create a console
window)
Nov 17 '05 #6
James Curran wrote:
"Ajay Kalra" <aj*******@yahoo.com> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
Then simply have a Console application. It will execute your
statements and exit as you want.


Not exactly. He has a Windows application which never creates a
window, which is not a Console app (because it also does not create a
console window)


What I suggested was to have a console app as it appears OP does not really
need a Form.

--
Ajay Kalra [MVP - VC++]
aj*******@yahoo.com

Nov 17 '05 #7

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

Similar topics

0
1088
by: Rafal Zurkowski | last post by:
Hello everybody, Maybe my question is very simple but I can't find answer for it. And without it I can't go on. I have installed SQL 2000 Personal edition on Windows 98. All the setup process ran...
19
6694
by: trint | last post by:
Ok, I start my thread job: Thread t = new Thread(new ThreadStart(invoicePrintingLongRunningCodeThread)); t.IsBackground = true; t.Start(); There are lots of calls to controls and many...
4
2911
by: Phil Mc | last post by:
Say for example you have a application running on a windows 2003 server (that is on server, not from). This application needs to start child applications (must be stand alone console applications),...
16
2134
by: AJPlonka | last post by:
Can anyone tell me why this doesn't start hidden? Public Class Form1 Inherits System.Windows.Forms.Form Public Sub New() MyBase.New() InitializeComponent() End Sub Protected Overloads...
4
1903
by: Notgiven | last post by:
This works: <input type="button" value="Add to list" onClick="addOption(param1, param2);"> But this doesn't: <img src="images/add.gif" onClick="addOption(param1, param2);"> The error I get...
5
1225
by: =?Utf-8?B?RGF2ZSBCdXJkb24=?= | last post by:
I have an unmanged C++ app (App A) which launches my VB app (App B). I need the form in AppB to be invisible until App A post a windows message that App B recognises and shows its form and...
3
7911
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
16
1830
by: ayush patel | last post by:
Hi, I have tried several ways to make this work but only found work arounds. so I am posting this as a last trial. I have a windows service which has to kick start and generate a file and email...
6
5811
Fr33dan
by: Fr33dan | last post by:
Hi all, I have a class that is written to display logging messages to a Form that I wrote. Because I don't want any other code to be stopped by the Form I decided to run the it in a separate...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.