Validate and get data from new instances in user control/tab page
Hi guys,
Currently working on a project that requires me to duplicate the contents of a 2nd tab page (TabPage2) from a Form1. Looked up previous threads about it and found this: http://www.vbforums.com/showthread.p...a-new-tab-page
While it has been helpful, I still don't know how to properly work with instantiated user controls. I've always used fixed controls (ie: controls with events/subs from the active form) and never tried these instantiated user controls before.
I'm using the following code to create (and remove) an instance of a tab with the corresponding user controls:
Code:
Private Sub btnAddIsolate_Click(sender As Object, e As EventArgs) Handles btnAddIsolate.Click
btnRemoveIsolate.Enabled = True
HAI.TabPages.Add(New ISOTab)
HAI.TabPages(tabCount).Name = "IsolateDetails" & tabCount
HAI.TabPages(tabCount).Text = "Isolate Details (" & tabCount & ")"
HAI.SelectedTab = HAI.TabPages(tabCount)
tabCount += 1
If tabCount = 5 Then
btnAddIsolate.Enabled = False
End If
End Sub
Private Sub btnRemoveIsolate_Click(sender As Object, e As EventArgs) Handles btnRemoveIsolate.Click
btnAddIsolate.Enabled = True
HAI.TabPages.Remove(HAI.TabPages(tabCount - 1))
tabCount -= 1
If tabCount = 2 Then
btnRemoveIsolate.Enabled = False
End If
End Sub
I'm at a stump right now as to how I can validate the fields in all the newly created tabpages, where to write the code for the validation and database transactions (ie: should it be on the main form class - Form1, or in the user control's code, or in the ISOTab's class code). Can anyone help lead me to where I can get resources for this (preferably on an elementary sort of level)? Thanks.