Hi,
I cannot figure out how to set the value of a specific cell in a new row to the value of a variable. Any ideas? Thanks! Here's the code I have:
'Set the variable to the value of the first row, first column:BusinessName = grdDetail.DisplayLayout.Rows(0).Cells(1).ValuehfCellToFocus.Value = 1
grdDetail.Rows.FromKey(0).Cells(1).Text = BusinessName 'THIS DOESN'T WORK, I get a message that says "Object reference not set to an instance of an object".
End Sub
Hello,
Your best option is to use the FromDataKey method or the index of the rows collection to find the row to update.
Please let me know if you have any questions.
Thanks,
Valerie
Thanks Valerie,
How do I code that? I've tried these with no luck...
grdDetail.Rows.FromDataKey(0) = sBusinessNamegrdDetail.Rows.FromDataKey("BusinessName") = sBusinessName
How does it know I want to set the "NEW" row BusinessName cell with the value of sBusinessName?