I have a datagrid that pulls in the information. I have a Edit button that works fine. When I go to edit a row, and click the Update button, I get an error saying:
Object reference not set to an instance of an object.

The code breaks on the
dname = CType(e.Item.FindControl("txtDeceasedName"), TextBox).Text line.

VB Code:
  1. 'Retrieve the data from the DataGrid
  2.         Dim mID As Integer
  3.         Dim dname As String
  4.         Dim relatedto As String
  5.         Dim relationship As String
  6.         Dim dateofdeath As Date
  7.         Dim notes As String
  8.         Dim visitation As String
  9.         Dim funeral As String
  10.  
  11.         mID = dgMemoriam.DataKeys(e.Item.ItemIndex)
  12.         dname = CType(e.Item.FindControl("txtDeceasedName"), TextBox).Text
  13.         relatedto = CType(e.Item.FindControl("txtRelatedTo"), TextBox).Text
  14.         relationship = CType(e.Item.FindControl("txtRelationship"), TextBox).Text
  15.         dateofdeath = CType(e.Item.FindControl("txtDateofDeath"), TextBox).Text
  16.         notes = CType(e.Item.FindControl("txtNotes"), TextBox).Text
  17.         visitation = CType(e.Item.FindControl("txtVisitation"), TextBox).Text
  18.         funeral = CType(e.Item.FindControl("txtFuneral"), TextBox).Text