Module globalVariable
Public tblScItem As New DataTable
Public tempArray()
Public index As Integer
Public stringArr() As String
End Module
Private Sub txtQty_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtQty.TextChanged
stringArr = New String() {"", txtItem.Text, Form2.cbGondola.SelectedItem, txtQty.Text, DateTime.Now, Form1.txtLoginId.Text}
If txtItem.Text <> Nothing And txtQty.Text <> Nothing Then
index = 0
tempArray(index) = stringArr
tblScItem.Rows.Add(tempArray)
index += 1
End If
End Sub
My program is a stock take program which works in a way that when the quantity of the item is entered, it will display in a datagrid and at the same time, store in an array. After the entire transaction is done, the entire array is exported to a txt file.
I have declared an array stringArr to store all the details of the an item. Then, i used a tempArray to store each item (which contains all the details in stringArr in the individual index of the tempArray.
Example:
tempArray(0) = 'details of item 1 obtained from stringArr
tempArray(1) = 'details of item 2 obtained from stringArr
and so on
However, i kept getting 'object is not set to an instance of an object' after the quantity is entered.
Anyone know why? I'm in need of help.
Thank you.