How can i stored values to 2D array variable in vb.net

Dec 4 2007 1:51 AM

Hi

Is Possible to store a value to declared Variable from Text Box at run time. I want to store a value from Text Box in 2 dimension array. First Value can be sotred in variable(0,0). If i press enter text box will be cleared and get another number and it stored in variable(0,1) and so on

I try the code as below but not working. I write this in Text Box KeyDown Event. If not in which event we write the code


Try
   If e.KeyCode = Keys.Enter Then
        For i As Integer = 0 To 1
                For j As Integer = 0 To 1
                        FirstMatrixArray(i, j) = val(txtInput.Text)
                        txtInput.Text = ""
                        txtInput.Focus()
                    Next
                Next
            End If
    Catch ex As Exception
         MessageBox.Show(ex.Message)
End Try


Answers (1)