|
Duy Pham wrote: I've tried calling the dataTable.Dispose() method in the event handler for the closing of Form A and still this seems to do nothing.
Then you have some design issue. Can you show us some sample code?
|
|
|
|
|
It's a fairly bulky program so I'll just paste over the instantiation of the objects.
EventHandler code within Form B (the parent form) which constructs Form A (the child form):
else if (radioButton_Inventory.Checked)
{
WindowInventory new_WindowInventory = new WindowInventory(
sqlconnector, sqlconn, inv_container);
new_WindowInventory.Activate();
new_WindowInventory.Show();
}
Now when Form B finishes being constructed, I use the _Load form event to stick in my code which assigns values to the data table.
private void WindowSales_Load(object sender, EventArgs e)
{
// ...
DataGridPopulator.PopulateWindowGrid_Sales(
partlist_array, ref dataTable_PartListing);
}
And then upon closing of Form B, I pass in these two lines:
dataTable_PartListing.Dispose();
this.Dispose();
Hope that helps. Thanks!
|
|
|
|
|
Why do you think that the data tables aren't disposed?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Say I open form B and close it 4 times successively. On the fifth time I open the form B, the messagebox.show() method will construct 5 message boxes with the values of 5 UNIQUE instances of the datatable. Which makes sense since I constructed 5 data tables that didn't seem to dispose of itself upon the closing of Form B.
Hope that makes sense.
|
|
|
|
|
I don't understand what you mean...
In the constructor of form A you create one data table and show one message box? If you open and close form B, how does that have anything to do with the message boxes?
Perhaps you mixed up the form A and form B? What about calling them something that makes sense?
Duy Pham wrote: On the fifth time I open the form B, the messagebox.show() method will construct 5 message boxes with the values of 5 UNIQUE instances of the datatable.
It sounds like you are doing something that you don't think that you do... A single call to MessageBox.Show can not result in five message boxes.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Treat Form B as a the child form and Form A as the parent form. I know this sounds really bizzare, and I don't understand myself either, but the number of message boxes that appear form a SINGLE instantiation of form B is always equal to the number of times I opened (by open I mean instantiate a NEW form B, the child form, assuming any previously open instance of Form B had been closed).
The MessageBox.Show() lies within a EventHandler that I personally created from a _Tick event from a System.Windows.Form.Timer object.
private void updateTimer_Tick(object sender, EventArgs e)
{
//...
string msg = "";
for(int i = 0; i < dataTable_PartListing.Rows.Count; i++)
{
msg += dataTable_PartListing.Rows[i][0].ToString() + " ; " +
dataTable_PartListing.Rows[i][1].ToString() + " ; " +
dataTable_PartListing.Rows[i][2].ToString() + " ; " +
dataTable_PartListing.Rows[i][3].ToString() + "\n";
}
MessageBox.Show(msg);
updateTimer.Start();
}
In the above code, updateTimer is the System.Windows.Form.Timer object. By any chance, does leaving that timer on while trying to close the form leave the instance of the form, and thus all objects instantiated within it, still active?
Thanks
|
|
|
|
|
Hi everybody,
i have a question in my project,i need your help.
The question :when i printed a barcode label in b/s system,the System components like 'PrintDialog' and 'PrintDocument' does not work.while i used it in c/s system,it was worked.So,i want to know how to solute it.
|
|
|
|
|
open http://www.commstudio.com/ , maybe it will be usefull fur you
|
|
|
|
|
I want a control where there's three options: On (White background with check), Off (grayed background, no check) and Neutral (white background, no check). Any ideas?
modified on Thursday, September 4, 2008 1:10 PM
|
|
|
|
|
Jordanwb wrote: grayed background
.Enabled=false;
|
|
|
|
|
But then it will not respond to events. AFAIK there is not a 3 state checkbox standard in VS.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You may have to create your own control, inheriting from the checkbox control.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
There's a property that will allow your checkbox to have a tri-state. You should, in that case, check for the "CheckState" property instead of the "Checked" property.
You have
Off --> not checked
On --> Checked with "V"
In between --> Checked filled with a square.
hope this helps.
|
|
|
|
|
Thanks that's what I was looking for.
|
|
|
|
|
Use a CheckBox . Set the ThreeState property to true .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks, that's what I was looking for.
|
|
|
|
|
Hi there, is there a C# method that will allow me to search for all the files of a specific extension and then delete them? I know there is an Exists method, but what do I pass into the method? What I have available are the path to the files and its extension.
|
|
|
|
|
System.IO.Directory.Getfiles. I can't remember all the params but one is where to search, and what to search for. If you want to search for exe's you put "*.exe"
|
|
|
|
|
You can't delete using a pattern, you need to identify each file and delete it individually. Use the directoryinfo getfiles method with a pattern filter, loop and delete each file.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
I have to forms.
In my seconde form i have a button that updates the first form.
The problem is that when i click that button, the first form get updated , bud the second form desappears, then i have to click bring it back from the windows taskbar.
How can i prevent that? i want that the second form remains active.
Thanx.
|
|
|
|
|
try searching the site
"Update parent form" turned up this article which may be of use.
clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How you are updating form1 from form2?
Alternatively, you can show the second form as a modal window.
|
|
|
|
|
Listen,
try creating userforms and load then on the main form (using delegates)
or create child/parent form method
You can check that out here in codeproject, i myself already checked it.
Give it a try.
Do you really need to use to forms??? for any important reason???
in child/parent forms you can also use as many forms as you wish.
Good Luck
nelsonpaixao@yahoo.com.br
|
|
|
|
|
Hello,
for my project I'm dealing with a table layout with a bunch of images. When I click one of these images (left-click, that's a requirement), I would like to pop up a control, basically a listbox with some choices. How should I best go about this? My - probably poor - choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution. Has anyone some inspiration for me, how I could pop some control up on a form surface which already has a layout to it?
Thanks for the inspiration,
Morten
|
|
|
|
|
harleydk wrote: choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution
It is about the only solution, that I know of, unless you want to create some kind of table class that pops the listbox up, and then you are still having to use a form control.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|