I am trying to move value of cells of a datagridview to an array of textboxes. The code is like this.
Const col As Integer = 8
Const row As Integer = 12
For n = 0 To col
txtFigure(row, col) = New TextBox
txtFigure(row, col).Font = objFont
txtFigure(row, col).Left = n * txtFigure(row, col).Width + txtFigure(row, col).Left + fromLeft
txtFigure(row, col).Top = i * txtFigure(row, col).Height + txtFigure(row, col).Top + fromTop
Controls.Add(txtFigure(row, col))
txtFigure(row, col).Text = 0
Next
For i = 1 To 11
mAmt = (dgActuals.Rows(xRow).Cells(xColumn).Value)
If Not mAmt = 0 Then
txtFigure(i, 0).Text = mAmt
xColumn += 1
End If
Next i
The txtfigure(i,0).text has the type of text box.
the value of mAmt is non zero integer. I've tried convert.tostring(mamt) and mamt.tostring but the message is
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=SOME Project
Const col As Integer = 8
Const row As Integer = 12
For n = 0 To col
txtFigure(row, col) = New TextBox
txtFigure(row, col).Font = objFont
txtFigure(row, col).Left = n * txtFigure(row, col).Width + txtFigure(row, col).Left + fromLeft
txtFigure(row, col).Top = i * txtFigure(row, col).Height + txtFigure(row, col).Top + fromTop
Controls.Add(txtFigure(row, col))
txtFigure(row, col).Text = 0
Next
For i = 1 To 11
mAmt = (dgActuals.Rows(xRow).Cells(xColumn).Value)
If Not mAmt = 0 Then
txtFigure(i, 0).Text = mAmt
xColumn += 1
End If
Next i
The txtfigure(i,0).text has the type of text box.
the value of mAmt is non zero integer. I've tried convert.tostring(mamt) and mamt.tostring but the message is
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=SOME Project