Vb.Net Forms Issue
-
Hi, I am working on windows application. I have a form1 and when I click on a button in form1, it shows form2. I perform some Db operations in that form and then close it. When I close the form, I want the form1 to get loaded again. Form2 is not an MDI form. How can I implement this? Can anyone please help with this? Thanks!!
-
Hi, I am working on windows application. I have a form1 and when I click on a button in form1, it shows form2. I perform some Db operations in that form and then close it. When I close the form, I want the form1 to get loaded again. Form2 is not an MDI form. How can I implement this? Can anyone please help with this? Thanks!!
projectcode1 wrote:
I want the form1 to get loaded again.
Based on wht you described, it should still be there. What code did you do to instantiate and Show Form2? What code did you put in to make Form1 vanish? Also, VB6, or VB.NET? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
projectcode1 wrote:
I want the form1 to get loaded again.
Based on wht you described, it should still be there. What code did you do to instantiate and Show Form2? What code did you put in to make Form1 vanish? Also, VB6, or VB.NET? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks for your reply!! It's in VB.Net. You are right the form is still there but I want to refresh the data in the datagrid and combobox in form1 after I made some changes to the Db using form2. I can now load the form using call load() but the combobox or datagrid doesn't show the new value. The Db has the new value. Page is not getting repainted or refreshed!! Any help will be appreciated. Thanks.
-
Thanks for your reply!! It's in VB.Net. You are right the form is still there but I want to refresh the data in the datagrid and combobox in form1 after I made some changes to the Db using form2. I can now load the form using call load() but the combobox or datagrid doesn't show the new value. The Db has the new value. Page is not getting repainted or refreshed!! Any help will be appreciated. Thanks.
projectcode1 wrote:
I can now load the form using call load()
What??? Where did this come from? If Form1 depends on changes being made to the database by Form2, Form2 should be shown as a dialog, where Form1 waits for Form2 to close, then continues on. Something like this:
Dim newForm As New Form2
newForm2.ShowDialog() ' This is a blocking call, so Form1 will wait for Form2 to close!
' Refresh database objects here...RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
projectcode1 wrote:
I can now load the form using call load()
What??? Where did this come from? If Form1 depends on changes being made to the database by Form2, Form2 should be shown as a dialog, where Form1 waits for Form2 to close, then continues on. Something like this:
Dim newForm As New Form2
newForm2.ShowDialog() ' This is a blocking call, so Form1 will wait for Form2 to close!
' Refresh database objects here...RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
That seems right. Are you trying to perhaps close one form and open another?? Ty
-
projectcode1 wrote:
I can now load the form using call load()
What??? Where did this come from? If Form1 depends on changes being made to the database by Form2, Form2 should be shown as a dialog, where Form1 waits for Form2 to close, then continues on. Something like this:
Dim newForm As New Form2
newForm2.ShowDialog() ' This is a blocking call, so Form1 will wait for Form2 to close!
' Refresh database objects here...RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
HI Again, thanks for your reply. I did the same but how do i refresh the combox and datagrid in form1. The new value are not seen in the form1. Thanks a lot!
-
HI Again, thanks for your reply. I did the same but how do i refresh the combox and datagrid in form1. The new value are not seen in the form1. Thanks a lot!
How did you populate them in the first place? Same thing, only run it again after Form2 closes (returns from the ShowDialog call). This should NOT be done from Form2! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
How did you populate them in the first place? Same thing, only run it again after Form2 closes (returns from the ShowDialog call). This should NOT be done from Form2! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks! I tried doing that from form2 but didn't work. Then I called it from form1 event where I called the form2.showdialog, I had to add the item in the combobox there. Why not from form2 ???
-
Thanks! I tried doing that from form2 but didn't work. Then I called it from form1 event where I called the form2.showdialog, I had to add the item in the combobox there. Why not from form2 ???
Because Form2 doesn't, and shouldn't, know ANYTHING about the form that launched it. It's just bad practice. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome