Form_Load event problem
-
Within my Form I am using
this.Load += new System.EventHandler(this.ItemForm_Load);
private void ItemForm_Load(object sender, EventArgs e)
{
myDataSet.Merge(mainForm.newDataSet);
}However, the merge does not take place. Placing a breakpoint in the debugger shows that the ItemForm_Load never gets hit. Any pointers would be much appreciated.
-
Within my Form I am using
this.Load += new System.EventHandler(this.ItemForm_Load);
private void ItemForm_Load(object sender, EventArgs e)
{
myDataSet.Merge(mainForm.newDataSet);
}However, the merge does not take place. Placing a breakpoint in the debugger shows that the ItemForm_Load never gets hit. Any pointers would be much appreciated.
Where are you subscribing to the Load event? If it's after it's loaded it's never going to get called again. If it's not already there, put it in the constructor.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
Where are you subscribing to the Load event? If it's after it's loaded it's never going to get called again. If it's not already there, put it in the constructor.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)Many thanks for your reply. I had my load subscription within
private void InitializeComponent()
{}
-
Many thanks for your reply. I had my load subscription within
private void InitializeComponent()
{}
Hi, InitializeComponent() is the one method created and maintained by Visual Studio; you should not edit this method (and, since VS8 or VS9 it normally is in a separate file, based on C#3.0 partial classes, so you shouldn't even edit the entire myForm.designer.cs files Having it in there, is technically as good as having it in the Form's constructor, so the problem must be elsewhere. With the little info you have provided, I can't help you any further though. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
-
Within my Form I am using
this.Load += new System.EventHandler(this.ItemForm_Load);
private void ItemForm_Load(object sender, EventArgs e)
{
myDataSet.Merge(mainForm.newDataSet);
}However, the merge does not take place. Placing a breakpoint in the debugger shows that the ItemForm_Load never gets hit. Any pointers would be much appreciated.
I'm confused, why are you manually maintaining the form load event handler. If you double click on the forms title bar VS creates this in the Designer.cs as with any other event wiring. I only ever do this if I have multiple subscribers to a single event or I'm creating a custom event.