|
-
May 17th, 2009, 06:31 AM
#1
Thread Starter
Junior Member
Form load data before showdialog
I have problems with a form and load event.
My form manage items that can be added, deleted or modified. In load code, I initialize all vars to cero. This is OK to be ready to add items.
My problem is with modify and delete. To carry this, I must load vars from a source. So, in my foreing code I have this:
Code:
Dim frm As newMyForm
frm = New newMyForm()
Dim resultado As Boolean = frm.duplicar("0003")
If (resultado = False) Then
MsgBox("Could not open 0003")
frm.Close()
Return
End If
frm.ShowDialog()
Me.Close()
frm.duplicar load data based on 0003 as index.
My problem is that when showdialog is called, all data which were loaded from duplicar funct is put again to cero. How can I avoid this and load correct data into the form.
Thanks
-
May 17th, 2009, 06:39 AM
#2
Re: Form load data before showdialog
Have you stepped through the code to make sure that the data is indeed being cleared? Once you load data, it doesn't just disappear.
From my burrow, 2 feet under.
-
May 17th, 2009, 06:43 AM
#3
Re: Form load data before showdialog
You say that this:
In load code, I initialize all vars to cero.
Does that mean in the Load event handler of the form? The Load event handler is not executed until you LOAD the form, not when you CREATE the form. That means the Load event handler is executed AFTER you call ShowDialog.
Why do you need any code to set anything to zero anyway? It's a brand new form so everything is zero by default and will only have some other value if you set it so.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|