I have this problem when retrieving value from an array of string.
this is my code:
When Button1 is clicked, the length of strSplitted can be display correctly.Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strSplitted() As String = funSplitText(txtRinggit.Text) MessageBox.Show(strSplitted.Length) Dim intCounter As Integer For intCounter = 0 To strSplitted.GetUpperBound(0) MessageBox.Show(strSplitted(intCounter).ToString) Next End Sub
But the error oocurs inside the For...Next Statement in this line:The error message shows:Code:MessageBox.Show(strSplitted(intCounter).ToString)
Why is this so? it seem to retrieve the length of the array without problem, but has problem retrieving each value inside array.An unhandled exception of type 'System.NullReferenceException' occurred in Payroll System.exe.
Additional information: Object reference not set to an instance of an object.
How can i overcome this problem? please guide. thank you.




Reply With Quote