ny ideas how Ive broke this? It worked before but now I get this error
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
VB Code:
  1. Private Sub dgNewCarriageBuildSheets_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgNewCarriageBuildSheets.UpdateCommand
  2.         'Declare variables
  3.         Dim txtGearMotor As TextBox
  4.         Dim txtRPM As TextBox
  5.         Dim dropHand As DropDownList
  6.         Dim txtPCB As TextBox
  7.         Dim txtMeggaTest As TextBox
  8.         Dim txtfTest As TextBox
  9.         Dim dropULTest As DropDownList
  10.         Dim txtsTest As TextBox
  11.         Dim calWEProd As Calendar
  12.         Dim dropModel As DropDownList
  13.         Dim txtSerialNo As TextBox
  14.         'Get the key value
  15. [U]        Main.objCarriageBuildSheet.PublicSerialNo = dgNewCarriageBuildSheets.DataKeys(e.Item.ItemIndex)[/U]
  16.  
  17.         'Get other values from template columns
  18.  
  19.         txtGearMotor = CType(e.Item.FindControl("txtMotorNo"), TextBox)