Hi,
I have more than one forms in my program, and I would like to for
example, in form1, I will call form2 and in form2 it will call form3.
But the problem is when I call form2.Show, it does show the form2, but
how can I unload form1? If I put form1.close, it will close everything.
:(
In VB, I only have to put
call form2.show
call unload(form1)
I'm new in C#, so could someone help me?
Cheers!
Claudi
*** Sent via Developersdex http://www.developersdex.com *** 4 21497
On Tue, 17 May 2005 01:50:15 -0700, Claudia Fong wrote: Hi,
I have more than one forms in my program, and I would like to for example, in form1, I will call form2 and in form2 it will call form3.
But the problem is when I call form2.Show, it does show the form2, but how can I unload form1? If I put form1.close, it will close everything. :(
In VB, I only have to put
call form2.show call unload(form1)
I'm new in C#, so could someone help me?
This is because by default when you create a new WinForm application in C#,
the main method consists of one line of code. That line of code is
Application.Run(new Form1());. The effect of that is that the Application
adds an event handler for the Closed event of the form. In that event
handler it calls ExitThread. So when you close Form1 the application
exits. You would need to remove that line of code and take over
responsibility for when to call Application.Run and when to show Form1, and
when to call Application.ExitThread.
--
Tom Porterfield This is because by default when you create a new WinForm application in
C#, the main method consists of one line of code. That line of code is Application.Run(new Form1());. The effect of that is that the Application adds an event handler for the Closed event of the form. In that event handler it calls ExitThread. So when you close Form1 the application exits. You would need to remove that line of code and take over responsibility for when to call Application.Run and when to show Form1,
and when to call Application.ExitThread. Tom Porterfield
Hi, I have the same problem with Claudia
and I have a simple question..
"You would need to remove that line of code" ...where is this line...?? :)
Thanks..
iLo wrote: Hi, I have the same problem with Claudia and I have a simple question.. "You would need to remove that line of code" ...where is this line...?? :) Thanks..
Re-read my response, I stated exactly where it was. And re-read also as I
stated more was needed than simply removing a line of code.
--
Tom Porterfield
I understand the concept of "taking over" the control of the starting/ending
of the application.
However, the practicality is not necessarily the same as the concept.
Could you direct me to a website or other resource that could provide a good
example of how this is accomplished?
Thanks,
~Dan
"Tom Porterfield" wrote: On Tue, 17 May 2005 01:50:15 -0700, Claudia Fong wrote:
Hi,
I have more than one forms in my program, and I would like to for example, in form1, I will call form2 and in form2 it will call form3.
But the problem is when I call form2.Show, it does show the form2, but how can I unload form1? If I put form1.close, it will close everything. :(
In VB, I only have to put
call form2.show call unload(form1)
I'm new in C#, so could someone help me?
This is because by default when you create a new WinForm application in C#, the main method consists of one line of code. That line of code is Application.Run(new Form1());. The effect of that is that the Application adds an event handler for the Closed event of the form. In that event handler it calls ExitThread. So when you close Form1 the application exits. You would need to remove that line of code and take over responsibility for when to call Application.Run and when to show Form1, and when to call Application.ExitThread. -- Tom Porterfield This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harry J. Smith |
last post by:
I have written a Visual Basic program that does a long calculation and
writes the results to disk as it runs. If I click the Close button the
window closes but the program keeps running. How can I...
|
by: salo |
last post by:
hi
at visual basic 6
i write this
to the button1_cl1ck
unload form1
form2.show
|
by: V.Boomessh |
last post by:
Hai
can any one help me on this problem.
I am new to VB.NET.
I have 2 forms. (form1 and form2)
On click of a button in form1 i want to show form2 and
unload form1
|
by: brianbender |
last post by:
I am trying to load and unload assemblies dynamically and call methods
and properties when loaded into an Appdomain
I can load assemblies all day in the current AppDomain without
references and...
|
by: Sender |
last post by:
In VB6.0 we use Unload Form1 to unload (close) form1 -
what shall we have to write to unload a form in VB.Net
|
by: sam |
last post by:
I want to know how to unload form / application in VB.Net.
In VB 6, the coding is Unload Me but how about VB.Net?
VB.Net 1.1 Coding
--------------------
Private Sub InitializeComponent()...
|
by: lesperancer |
last post by:
I've got application A, with a hidden form, whose unload event is
cancelled unless you use an 'exit' button (so I can do special
processing)
this works fine when using just application A and it...
|
by: Stevo |
last post by:
I've been using the unload event for a long time. I have this code,
which I've abstracted and made into a stripped down simple test case
below, and it works fine on the major browsers (IE5+,...
|
by: Shawn |
last post by:
Have had a complete brain-fart and cannot think of how to stop code
execution without unloading the form in vb.net. In other words, if my
code catches an error, I want it to tell the user and stop...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |