473,385 Members | 1,523 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,385 software developers and data experts.

Starting a windows application from outside the form

Hi,

Can anyone suggest how to go about running a windows application from
outside the starting form. ie. making a call to the initial form and then
showing it. I have tried this using a separate class file with static void
Main()
{
MainForm mf = new MainForm();
mf.Show();
}

But as soon as the form shows the application ends. As you can tell i am an
absolute novice so any help would be appreciated.

Thanks,
Jesse
Nov 15 '05 #1
4 1261
You need to keep pumping the Window messages to the window. You can do that
by

Main()
{
MainForm mf = new MainForm();
Application.Run(mf);
}

-vJ

"Jesse" <je*****@hotmail.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi,

Can anyone suggest how to go about running a windows application from
outside the starting form. ie. making a call to the initial form and then
showing it. I have tried this using a separate class file with static void Main()
{
MainForm mf = new MainForm();
mf.Show();
}

But as soon as the form shows the application ends. As you can tell i am an absolute novice so any help would be appreciated.

Thanks,
Jesse

Nov 15 '05 #2
Hi, thanks for the reply.

When i do that i get an error:

"The type or namespace name 'Application' could not be found ..."

what does this mean?

"Vijaye Raji" <no************@hotmail.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
You need to keep pumping the Window messages to the window. You can do that by

Main()
{
MainForm mf = new MainForm();
Application.Run(mf);
}

-vJ

"Jesse" <je*****@hotmail.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi,

Can anyone suggest how to go about running a windows application from
outside the starting form. ie. making a call to the initial form and then showing it. I have tried this using a separate class file with static void
Main()
{
MainForm mf = new MainForm();
mf.Show();
}

But as soon as the form shows the application ends. As you can tell i

am an
absolute novice so any help would be appreciated.

Thanks,
Jesse


Nov 15 '05 #3
Try System.Windows.Forms.Application or add "using System.Windows.Forms" to
the top of the file.

-vJ

"Jesse" <je*****@hotmail.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
Hi, thanks for the reply.

When i do that i get an error:

"The type or namespace name 'Application' could not be found ..."

what does this mean?

"Vijaye Raji" <no************@hotmail.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
You need to keep pumping the Window messages to the window. You can do

that
by

Main()
{
MainForm mf = new MainForm();
Application.Run(mf);
}

-vJ

"Jesse" <je*****@hotmail.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi,

Can anyone suggest how to go about running a windows application from
outside the starting form. ie. making a call to the initial form and then showing it. I have tried this using a separate class file with static

void
Main()
{
MainForm mf = new MainForm();
mf.Show();
}

But as soon as the form shows the application ends. As you can tell i

am
an
absolute novice so any help would be appreciated.

Thanks,
Jesse



Nov 15 '05 #4
Wooho. That works. Thanks.
"Vijaye Raji" <no************@hotmail.com> wrote in message
news:#v**************@tk2msftngp13.phx.gbl...
Try System.Windows.Forms.Application or add "using System.Windows.Forms" to the top of the file.

-vJ

"Jesse" <je*****@hotmail.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
Hi, thanks for the reply.

When i do that i get an error:

"The type or namespace name 'Application' could not be found ..."

what does this mean?

"Vijaye Raji" <no************@hotmail.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
You need to keep pumping the Window messages to the window. You can do
that
by

Main()
{
MainForm mf = new MainForm();
Application.Run(mf);
}

-vJ

"Jesse" <je*****@hotmail.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
> Hi,
>
> Can anyone suggest how to go about running a windows application
from > outside the starting form. ie. making a call to the initial form and then
> showing it. I have tried this using a separate class file with
static void
> Main()
> {
> MainForm mf = new MainForm();
> mf.Show();
> }
>
> But as soon as the form shows the application ends. As you can tell

i am
an
> absolute novice so any help would be appreciated.
>
> Thanks,
> Jesse
>
>



Nov 15 '05 #5

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

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
6
by: Jon Hyland | last post by:
Ok, I'm a little rusty on this, it should be a simple problem but I can't figure it out. How can I handle form events in my main code page?? I'm creating a Windows App in C#. Rather than make...
1
by: Glenn | last post by:
I have used this code successfully in a form application. I tried to add the same code in a service and have not been able to get the application to start. I have the service starting with a local...
5
by: VMI | last post by:
I have a BMP image (the form is also in PDF) that contains a scanned copy of a paper form that we need to fill out. Is it possible to use this image in my application so that the application can...
4
by: Michael C# | last post by:
I have a Windows Form I want to add to another form similar to the way you add an OpenFileDialog to a Windows Form from the Toolbox. Thx
16
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...
5
by: Michael Moreno | last post by:
Hello, I would like to cancel an action if the user holds the shift key while the application is starting-up. Would you know what is the best way to do so please? Thanks, Michael
28
by: | last post by:
I have a multi threaded windows form application that runs great after calling Application.Run(). Application.Run is required for a COM component I a using in the app (required for message loop). ...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.