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

Form Not Disposed?? I think...Not sure what I have done

Hi

I have code to open a form modally:

MM.Forms.frmAddProductWizard fAddProdWiz = new
MM.Forms.frmAddProductWizard();
fAddProdWiz.txtName.Text =
dgvImportReview.Rows[e.RowIndex].Cells["Name"].Value.ToString();
int mfgrid =
System.Convert.ToInt32(dgvImportReview.Rows[e.RowIndex].Cells["ManID"].Value);
fAddProdWiz.cmbMfgr.SelectedValue = mfgrid;
fAddProdWiz.PopulateOtherDropDowns(mfgrid);
fAddProdWiz.cmbProdLine.SelectedValue =
System.Convert.ToInt32(dgvImportReview.Rows[e.RowIndex].Cells["LineID"].Value);
//fAddProdWiz.txtName.Text =
dgvImportReview.Rows[e.RowIndex].Cells["Name"].Value.ToString();
if (fAddProdWiz.ShowDialog() == DialogResult.OK)
{
}
fAddProdWiz.Dispose();

in the form I have cmbMfgr_SelectedIndexChanged event for a combo box. When
it is loading the page I don't want it to change the values in the other
drop downs, once I have finished loading the form I do.

private void cmbMfgr_SelectedIndexChanged(object sender, EventArgs e)
{
if (pageIsLoading)
return;
PopulateOtherDropDowns(System.Convert.ToInt32(this .cmbMfgr.SelectedValue));
}

It works great the first time around. Second and subsequent times although I
set the pageIsLoading bool to true, by the time it gets to the above method,
it is false. I don't understand. I have closed the form and it has triggered
the Dispose() code.

So why even though at the beginning of the form pageIsLoading is true is it
changing to false. If I stop the program and start it again everything is
fine. It seems to me that it is retaining something in memory, but I don't
know what. I have used this sort of technique multiple times.

I am using VS 2005, .NET 2.0, Win XP Pro SP2.

Thanks

Tim
Mar 2 '06 #1
0 860

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

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
2
by: EMW | last post by:
I have one form which is my main form and has 4 option buttons and two regular buttons, one for saving and the other for canceling the program. When the user select an option button, a new form is...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
0
by: EMW | last post by:
I am busy with a program for my pocket pc. but since it is still compact famework, I'll post this here too, because I'm very much in need for some help with this: I have one form which is my...
7
by: Boni | last post by:
Dear all, if I do myform.close() is it disposed or not? is it correct do following? myForm.close() Info=SomeControlOntheForm.text This seems to work. But am not sure that it is waterproof....
11
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
31
by: Zytan | last post by:
There is no IsDisposed() method. I could just access it, and catch ObjectDisposedException, but that seems ugly. Zytan
3
by: Jon | last post by:
My main form opens up another form, and from this other form, I'd like to access things in the main form. The problem is that although I know the name of the class of the main form (FormMain) I...
19
by: rbrowning1958 | last post by:
Hello, I am confused by dispose etc. and hope someone can set me right. 1. The Dispose(Bool) the IDE generates for a form has nothing to do with IDisposable, right? 2. So when is this called?...
2
by: BillE | last post by:
Using vb.net 2008 windows forms. How can a form which has been closed and disposed still attempt to handle a custom event? I have a form which inherits from a base form class. The base...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
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
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
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...
0
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...
0
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,...

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.