I am trying to move value of cells of a datagridview to an array of textboxes. The code is like this.
For i = 1 To 11
mAmt = (dgActuals.Rows(xRow).Cells(xColumn).Value)
If Not mAmt = 0 Then
txtFigure(i, 0).Text = mAmt
xColumn += 1
When run it shows that Nullreferenceexception was unhandled
Object reference not set to an instance of an object.
Could any body help please.
You always need to provide comprehensive error information, first of all — show the line of the code and indicate where is the source of the error. Most likely, you tried to assign integer value to the instance of the class —SA
TextBox. You should assign
MyTextBox.Text = mAmt.ToString(...). Probably,
txtFigure(i, 0).Text has the type of
You really need to learn very basics of programming in general and OOP in particular before you can really continue. Learn types and objects/instances, classes and their members, static and instance members, .NET type system, boxing, reference vs value types, etc.
I have managed to find solution to my problem and you do not have to be so AGGRESSIVE while answering queries.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)