Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
How to Set a cell Value in a New Row
posted

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:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Protected Sub btnAddParent_Click(ByVal sender As System.Object, ByVal e As  System.Web.UI.ImageClickEventArgs)

 

 

Dim BusinessName As String

 

 

'Set the variable to the value of the first row, first column:
BusinessName = grdDetail.DisplayLayout.Rows(0).Cells(1).Value

hfCellToFocus.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