wallaceoc80
Programmer
Hi everyone,
It's been a long while since I did vb.net and I can't remember how to do something very simple!!!
I have a ComboBox on form1 and another one on Form2. What I want to do is when the user clicks on a button that loads form2 I want to pass the DataSource from the ComboBox on form1 to the one on form2.
I assume this is possible but have a few questions:
1) Do I pass the paramater ByVal or ByRef?
2) Do I have the paramater on form2 as a type Object?
3) Is something like this enough?
Form1
Form2
Thanks for the help in advance.
Wallace
It's been a long while since I did vb.net and I can't remember how to do something very simple!!!
I have a ComboBox on form1 and another one on Form2. What I want to do is when the user clicks on a button that loads form2 I want to pass the DataSource from the ComboBox on form1 to the one on form2.
I assume this is possible but have a few questions:
1) Do I pass the paramater ByVal or ByRef?
2) Do I have the paramater on form2 as a type Object?
3) Is something like this enough?
Form1
Code:
Private Sub btnManage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnManage.Click
Me.frmManageReports = New frmReportManage
Me.frmManageReports.setupFromReport(Me.cmbReport.DataSource)
Me.frmManageReports.Visible = True
End Sub
Form2
Code:
Public Sub setupFromReport(ByVal data As Object)
Me.cmbFromReport.DataSource = data
Me.cmbFromReport.Enabled = True
End Sub
Thanks for the help in advance.
Wallace