Hello,
How do I reinitialise a form load event?
Example;
Form1 Loads data from a Db and has 3 buttons, each button represents showing data from a different table onto form2
When form2 is initialise for the first time i can use an onload event, but if i go back to page 1 and click a different button to show a different table i get the table from the origional as form2 does not use the onLoad event again.
To switch between forms i use
Class Form1
Public Shared whichtbl as string
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'<Load Data etc>
End sub
Private Sub btntbl1Data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntbl1Data.Click
whichtbl = "tbl1"
Me.Hide()
Form2.Show()
End Sub
End class
Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
if whichtbl = "tbl1" then
'<Load Data from button selected>
elseif whichtbl = "tbl2" then
'<Load Data from button selected>
elseif whichtbl = "tbl3" then
'<Load Data from button selected>
end if
End sub
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
Me.Hide()
Form1.Show()
End Sub
End Class
This is just some example code.
Thanks in advance for all your help