You could send the array in the parent form to the child form
Parent form
Child formCode:Private Questions(10) As String . . . Private Sub Button1_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click . . . Dim f As New frmChildForm(Questions) Try f.ShowDialog() Finally f.Dispose() End Try
Or MainFormCode:Public Class frmChildForm Private Questions() As String Public Sub New(ByVal sender() As String) InitializeComponent() Questions = sender End Sub Private Sub Form2_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ListBox1.DataSource = Questions End Sub End Class
Child formCode:Public Class frmMainForm Private mQuestions(10) As String Public ReadOnly Property Questions() As String() Get Return mQuestions End Get End Property . . . Dim f As New frmChildForm Try f.ShowDialog() Finally f.Dispose() End Try
To add a single itemCode:Public Class frmChildForm Private Sub Form2_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ListBox1.DataSource = frmMainForm.Questions End Sub End Class
Code:ListBox1.Items.Add(frmMainForm.Questions(0))




Reply With Quote