Note that there are some explanatory texts on larger screens.

plurals
  1. POObject reference not set to a instance of an Object
    text
    copied!<p>I have a gridview that fills with data, and a view button which gives more details of the record choosen by the user. I cannot figure out why I am getting the error:</p> <blockquote> <p>Object reference not set to a instance of an Object</p> </blockquote> <p>I have narrowed it down to between my two message boxes. The First message box comes up but it crashes before the second. Any suggestions would be greatly appreciated. </p> <pre><code> Protected Sub CountAlerts_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles CountAlerts.RowCommand If (e.CommandName = "Viewdtails") Then Dim index As Integer = Convert.ToInt32(e.CommandArgument) Dim NDC, Unit, Cell, DTTM, prod, Query, _startdt, _enddt As String Dim DS As DataSet NDC = CountAlerts.DataKeys(index).Values("NDC") Cell = CountAlerts.DataKeys(index).Values("Cell") Unit = CountAlerts.DataKeys(index).Values("Unit") DTTM = CountAlerts.DataKeys(index).Values("TimeDate") prod = CountAlerts.DataKeys(index).Values("ProductDesc") _startdt = If(StartDate.Text = "", DateAdd(DateInterval.Day, -7, System.DateTime.Now).ToShortDateString, StartDate.Text) _enddt = If(EndDate.Text = "", System.DateTime.Now.ToShortDateString, EndDate.Text) For Each irow As GridViewRow In CycleCountAlerts.Rows If irow.Attributes("class") = "highlight" Then irow.Attributes.Remove("class") End If Next CountAlerts.Rows(index).Attributes("class") = "highlight" Query = " EXEC [Audits].[dbo].[ExceptionDetailsCombined] '" &amp; NDC &amp; "', '" &amp; Cell &amp; "', '" &amp; Unit &amp; "', '" &amp; DTTM &amp; "', '" &amp; Master.CF_User.Viewing &amp; "' " DS = SelectQuery(Query) If (DS.Tables.Count &gt; 0) Then unitbox.Text = DS.Tables(0).Rows(0)("Unit") cellbx.Text = DS.Tables(0).Rows(0)("Cell") ndcbox.Text = DS.Tables(0).Rows(0)("NDC") namebox.Text = DS.Tables(0).Rows(0)("ProductDesc") cycdttmbx.Text = DS.Tables(0).Rows(0)("TimeDate") cycusr.Text = DS.Tables(0).Rows(0)("CycUser") todisp.Text = DS.Tables(0).Rows(0)("TODISPSIZE") topkgbox.Text = DS.Tables(0).Rows(0)("TOPKGSIZE") toqtybx.Text = DS.Tables(0).Rows(0)("TOQTY") FRQTYbx.Text = DS.Tables(0).Rows(0)("FRQTY") TextBox2.Text = DS.Tables(0).Rows(0)("ActualQTY") cycvarqbox.Text = DS.Tables(0).Rows(0)("CYCLEVARQTY") CycleVarPctbx.Text = DS.Tables(0).Rows(0)("CYCLEVARPCT") alertrsnbx.Text = DS.Tables(0).Rows(0)("AlertReason") combox.Text = DS.Tables(0).Rows(0)("AcceptComment") acusr.Text = DS.Tables(0).Rows(0)("AcceptUser") acctime.Text = DS.Tables(0).Rows(0)("AcceptTime") accstatbx.Text = DS.Tables(0).Rows(0)("AcceptStatus") displbl.Text = DS.Tables(0).Rows(0)("Disposition") End If Query = " EXEC [CF_Audits].[dbo].[CommentTrackerCombined] '" &amp; Master.CF_User.EmployeeID &amp; "', '" &amp; NDC &amp; "', '" &amp; Cell &amp; "', '" &amp; Unit &amp; "', '" &amp; _startdt &amp; "', '" &amp; _enddt &amp; "', '" &amp; Master.CF_User.Viewing &amp; "' " DS = SelectQuery(Query) If (DS.Tables.Count &gt; 0) Then ExceptionHist_GV.DataSource = DS ExceptionHist_GV.DataBind() ExceptionHist_GV.UseAccessibleHeader = True MsgBox("except gv header") 'Runs up to here. ExceptionHist_GV.HeaderRow.TableSection = TableRowSection.TableHeader MsgBox("except gv header 2") ' Does not make it to here. End If End If End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload