Public Class Form1 Dim m, n, i, j As Integer Dim arr(20) As array1 [B] Structure array1 Public a()() As Array End Structure [/B] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Button1.Enabled = True Button2.Enabled = True Button3.Enabled = True Button4.Enabled = True End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click m = InputBox("Number of Employee") n = InputBox("Number of Product") j = 0 For i = 1 To m - 1 Step 1 // error in this line as value of string type cannot be converted to system.array [B][U]arr(j).a(i)(0) = Val(TextBox1.Text)[/U][/B] 'MessageBox.Show(arr(j).a(i)(0)) Next i End Sub End Class[code=vb.net]

Public Class Form1
Dim m, n, i, j As Integer
Dim arr(20) As array1

Structure array1
Public a()() As Array
End Structure

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = True
Button2.Enabled = True
Button3.Enabled = True
Button4.Enabled = True
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
m = InputBox("Number of Employee")
n = InputBox("Number of Product")
j = 0
For i = 1 To m - 1 Step 1
// error in this line as value of string type cannot be converted to system.array
arr(j).a(i)(0) = Val(TextBox1.Text)
'MessageBox.Show(arr(j).a(i)(0))
Next i
End Sub
End Class

Public Class Form1
    Dim m, n, i, j As Integer
    Dim a(20)() As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.Enabled = True
        Button2.Enabled = True
        Button3.Enabled = True
        Button4.Enabled = True
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        m = InputBox("Number of Employee")
        n = InputBox("Number of Product")

        For i = 1 To m - 1 Step 1
           [B][U] '' error in this line as Object reference not set to an instance of an object.
            a(i)(0) = InputBox("ENTER")[/U][/B]
            MessageBox.Show(a(i)(0))


        Next i
    End Sub
End Class

You haven't assigned the number of elements in the second dimension of the array: Dim a(20)() As Integer either Dim a(20)(10) As Integer ' For example 10 or later in the code ReDim a(20)(10) or from a variable ReDim a(20)(SomeVariable)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.