|
How do you close the app? Do you handle the Closing event yourself?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Here is what I do...
I have a main form called HomeForm. Another form called EnggHome has the exit button.
I call the EnggHome form HomeForm as
<br />
private void button3_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
EnggHome enggH = new EnggHome();<br />
enggH.Show(); <br />
this.Visible = false; <br />
<br />
}
In exit button code (in EnggHome)
<br />
private void button3_Click(object sender, System.EventArgs e)<br />
{ <br />
<br />
this.Dispose(true);<br />
this.Close();<br />
<br />
HomeForm Hom = new HomeForm();<br />
Hom.Dispose(); <br />
Hom.Close();<br />
<br />
}
In debug mode too, if I close the app using exit button, the debugger does'nt stops unless I stop it..
What am I missing???
|
|
|
|
|
I see some problems here: in the button3 handler, you instantiate a new instance of the MainForm. I suggest that you implement a constructor for EnggHome that takes a handle to the HomeForm parent form, and keep it among its private data members. In the button3 handler button for EnggForm, just call the HomeForm.Close() method.
public class EnggHome : Form
{
private Form _parentForm;
public EnggHome(Form parentForm)
{
this._parentForm = parentForm;
}
private void button3_Click(object sender, System.EventArgs e)
{
this.Dispose(true);
this.Close();
this._parentForm.Visible = true; <--- did you previously instantiate a new object to have you form reappear???
this._parentForm.Dispose();
this._parentForm.Close();
}
}
and in the HomeForm class method, when instantiating the EnggHome object:
private void button3_Click(object sender, System.EventArgs e)
{
EnggHome enggH = new EnggHome(this); <--- Notice the different constructor call.
enggH.Show();
this.Visible = false;
}
A more drastic approach would be to call Application.Exit(0) , but this would not give a chance to the parent form to clean up.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
-- modified at 16:55 Thursday 5th January, 2006
|
|
|
|
|
Thank you so much for ur reply. It works. But in my app I have like 10 forms. and in all the forms I have button called "Home" that calls the HomeForm using new HomeForm(). I navigate all the forms sequentially that say HomeForm is form1->EnggHome is form2->form3->form4...so on. So should I pass the homeform in the constructor of all the forms...or is there any other better way??
Thanks again.
|
|
|
|
|
Do you mean HomeForm creates EnggForm, which creates EnggForm, which creates EnggForm, etc. like a chain?
In this case, I suggest that each form has a handle to its parent, so you can navigate back.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Have you considered turning all your forms into controls, and hosting them all on the one form ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I noticed that in the button3 handler in HomeForm, you lose the reference to the instantiated EnggHome form. Although seemingly correct in your code, it is a good practice to keep a reference to do proper cleanup when quitting.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
|
In HomeForm, have a private variable that retains the reference to the form.
private EnggForm _childForm;
.....
in your button3 handler:
this._childForm = new EnggForm(this);
instead of:
EnggForm enggForm = new EnggForm(this);
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Hi there I'm working on a project which involves digital signatures.
I take custom made key files and import modulus public and private exponent on RSAParameters.With this info I can encrypt data without any problem
Unforunately when I call the sign method I get an exception about including the private part of the key that means the P/Q/DP/DQ values of the keys.
Anyway how can I calculate the P and Q values given that the only info I have about the private key is the D parameter and the exponent.
Please help me
Thank you in advance
|
|
|
|
|
I'm trying to add a 2px white right border to items in a datagrid but i don't seem to work.
<br />
In my .css file<br />
.grid_item<br />
{<br />
background-color: #f3f3f3; <br />
border-right-color: White;<br />
border-right-width: 2px;<br />
border-right-style: solid;<br />
}<br />
<br />
In my .aspx file<br />
asp:datagrid id="dgCostumerList" runat="server" CssClass="grid" AllowPaging="False" Width="680px"<br />
CellPadding="3" GridLines="None" AutoGenerateColumns="False" PageSize="200"><br />
AlternatingItemStyle CssClass="grid_item"></AlternatingItemStyle><br />
ItemStyle CssClass="grid_item"></ItemStyle><br />
<br />
In a normal item in a this works fine.
Does anyone know, it dosn't work here?
Thanks
Thomas
-- modified at 15:14 Thursday 5th January, 2006
|
|
|
|
|
Does the background color work?
---
b { font-weight: normal; }
|
|
|
|
|
Yes, all other things I do works fine.
|
|
|
|
|
i make webRequest to get web site info
but i need to know
how can delete cookies after each webRequest ?
Palestine
|
|
|
|
|
I have two to different sets of themes for my windows form. Selecting each
form should change the Images, color sets and other appearance related
properties for the controls on the form. What could be the best way to
approach this problem. I was thinking of saving these setting in different
XML files and read from them on fly when theme is changed by the user. But
any other ideas or suggestions would be very much appreciated.
I was thinking something like this........
<root>
<imagesfoldername> images1
<labelbackcolor>Red
Dark Gray
Thanks,
VPMahank
|
|
|
|
|
ImageList.ImageSize supports only 255x255 pixel images. Is there a way to get around that.
I know this is by design.
I am trying to drag drop listview columns. But I need larger image size to achieve that.
Live Life King Size
Alomgir Miah
-- modified at 14:24 Thursday 5th January, 2006
|
|
|
|
|
Can anyone recommend a good beginners reference book on how to write code in C# for carrying out real time audio signal processing using Managed DirectX 9. I am interesting in writing some basic Software Defined Radio code, to get a better understanding of its coding, but have never written code using DirectX before - Thanks.
|
|
|
|
|
Managed Direct X contains a namespace called 'AudioVideoPlayback'. It's crap, it's not complete, and it's not going to be upgraded. DirectX no longer supports any sort of audo/video stuff, DirectShow has all been removed. Your best bet for now would be to find a third party wrapper to DirectShow that is more complete than the one that comes with the SDK.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Oh yeah, AudioVideoPlayback is utter sh*t. Has any person on earth managed to RenderToTexture yet? Looks like there are absolutely no alternatives for MDX.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi , i'm searching for a help about implementation of Pluggable Protocols Handles.
I got one (by Brummer) that implement a particular protocol and run ok, but i need one to simulate the http protocol it self.
How could i to registry this procotol for urlmon.dll detect it ?
thank's
|
|
|
|
|
Have you checked out this article about pluggable protocols?
And, I'm sorry; I don't understand what you mean by "simulate the http protocol itself."
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi, i did mean that i need to handle the Internet Explorer to capture data from any site like the http protocol do.
I made a test using your tip but it don't work.
thank's.
|
|
|
|
|
i'm creating a program that use a custom scrollbar made using 2 normal buttons with my own drawing.
The top button move a panel over the bottom move the panel down.
This panel show objects height the same 100 pixel all objects.
What is the better way to create a scrollbar like this?
If these items are many as 100 or 1000 it is absourd to create all them if i see just 20-25 at time, so what is the better way to scroll them without load the at the same time?
My software is like Outlook where all the item are the name - email - attach field, i can receive 2000 or more email, does outlook load all them in the same time showing just 30-40 in the visible area?
I hope to have me explained.
-- modified at 12:54 Thursday 5th January, 2006
|
|
|
|
|
Outlook will look into it's database, get back the records being shown, and display them. It may cache a few either side to help the display when scrolling.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How could I retrive page source from a given website/url ?? Do I need to write HTTPrequest in order to do this or is there any other ways?? I need the page source in order to find out what is the likely content of that page and then uses this information to make an application to seach for website of similar content of in a different languages.
|
|
|
|