Hi,
I have a form with a button that calls a public sub
which all works fine.
I now have another form which also needs to call this same code.
I've worked out how to identify which form called the sub using
, but what I'm really looking for is a way to setup the equivalent of pointers to the 4 controls that exist on both forms, so at the beginning of the sub, I'll setup these pointers to either the 4 controls on 1 form or the 4 controls on the other form, depending on which form called the sub.
Now this next line
works fine, but this one doesn't:
So it seems I can reference (or point) to an object if it is on the same form as the code, but not if it is on another form..
My only other thought was move all the code into a public function and pass the names of all the controls to it
So, Any thoughts on how to create a reference to an object (textbox or listbox etc) on another form?
Thanks
Kristian
I have a form with a button that calls a public sub
Code:
(Public Sub btnImport_Experiment_Data_Files_OLS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport_Experiment_Data_Files_OLS.Click)
I now have another form which also needs to call this same code.
I've worked out how to identify which form called the sub using
Code:
CType(sender, Button).Name
Now this next line
Code:
Dim textbox As Object = Me.txtNumber_of_Data_Files_Imported
Code:
Dim textbox As Object = frmNon_Titration.txtNumber_of_Data_Files_Imported
My only other thought was move all the code into a public function and pass the names of all the controls to it
So, Any thoughts on how to create a reference to an object (textbox or listbox etc) on another form?
Thanks
Kristian