|
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
|
|
|
|
|
When the user clicks, get the mouse cursor (I don't remember how), set the location of the listbox to the location of the cursor, and add it to the form and not the table.
|
|
|
|
|
As Jordanwb suggested but you can have an invisible control and just move it and make it visible when required (may be better than creating and disposing of the control repeatedly). Deciding when to make it invisible after the user is finished will be the issue I would think.
Mouse location is easy to trap on the click event.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hey Guys,
I have a datagridview that uses a DataTable as the data source: (dgv.DataSource = dataTable;)
The data loads into the dgv perfectly but it does not appear to be syncronized with the dataTable.
For instance, let's say I add a new row using the dgv. When I view the underlying DataTable, I don't see the new row added. This may be an easy question but I've scratched my head all day long trying to answer it. Once I can get the dgv's new rows to be added to the DataTable, I can update the table back to the database. Is there a function that I'm supposed to call from the dgv?
I've used up all my sick days, so today I'm calling in dead.
|
|
|
|
|
I think you should put a bindingsource between dgv and datatable.
|
|
|
|