Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I have deployed my Visual Basic.NET application. It's working fine however every now and then Get the following error.

 

Exception Type: System.NullReferenceException

Exception Message: Object reference not set to an instance of an object.

Exception Target Site: DisplayRXMV

 

---- Stack Trace ----

Test.frmMain.DisplayRXMV()

Test.exe: N 01679 <-- not sure what this means.

 

It's not giving me enough information to determine what line in the DisplayRXMV method. My code for the method is as follows:

Private Sub DisplayRXMV()
       Dim DsDrugs As New DataSet("RxDrugs")
       Dim DrugTable As New DataTable("Drug")
       Dim DrugCBCol As New DataColumn
       Dim DrugNameCol As New DataColumn
       Dim DrgName As String
       Dim DrgDispense As String
       Dim DrgRefills As String
       Dim DrgNote As String
       Dim DrgSig As String
       Dim DrgTransmittedBy As String
       Dim DtRow As DataRow
       Dim DrugLoop As Integer
       Dim TempStr As String
       Dim BooleanCheck As String

       Try
           'Checking for a null value in the varlistofrx array.
           If VarListOfRx Is Nothing Then
               Exit Sub
           End If

           'fix - EH - 10/20/05
           Dim DisplayCounter As Integer = 0 'used to sync rx list with displayed values
           'end fix

           DrugCBCol.DataType = System.Type.GetType("System.Boolean")
           DrugCBCol.ColumnName = "CB"

           DrugNameCol.DataType = System.Type.GetType("System.String")
           DrugNameCol.ColumnName = "Prescription"

           DrugTable.Columns.Add(DrugCBCol)
           DrugTable.Columns.Add(DrugNameCol)

           For Each Rx As Prescription In VarListOfRx
               'fix - EH - 10/20/05
               Rx.MVRXListID = DisplayCounter
               'end fix
               DrgName = Rx.RXDrugName
               DrgSig = Rx.Dose & " - " & Rx.Signature
               DrgDispense = "Dispense: " & Rx.Dispense
               DrgRefills = "Refills: " & Convert.ToString(Rx.Refills)
               If Rx.AlreadyTransmitted > 0 Then
                   Select Case Rx.AlreadyTransmitted
                       Case 1
                           DrgTransmittedBy = "Transmit Fax by: " & Rx.TransmittedBy
                       Case 2
                           DrgTransmittedBy = "Transmit Fax Success by: " & Rx.TransmittedBy
                       Case 3
                           DrgTransmittedBy = "Transmit Fax Failure by: " & Rx.TransmittedBy
                       Case 4
                           DrgTransmittedBy = "Transmit Print by: " & Rx.TransmittedBy
                       Case 5
                           DrgTransmittedBy = "Transmit Print and Fax by: " & Rx.TransmittedBy
                       Case 6
                           DrgTransmittedBy = "Transmit Print and Fax Success by: " & Rx.TransmittedBy
                       Case 7
                           DrgTransmittedBy = "Transmit Print and Fax Failure by: " & Rx.TransmittedBy
                       Case 8
                           DrgTransmittedBy = "Transmit Email by: " & Rx.TransmittedBy
                   End Select
               Else
                   DrgTransmittedBy = ""
               End If
               'If Rx.AlreadyTransmitted > 0 Then
               '    DrgTransmittedBy = "Transmitted By: " & Rx.TransmittedBy
               'Else
               '    DrgTransmittedBy = ""
               'End If

               DtRow = DrugTable.NewRow
               DtRow("Prescription") = DrgName & vbNewLine & DrgSig & vbNewLine & DrgDispense & vbNewLine & DrgRefills & vbNewLine & DrgTransmittedBy
               DtRow("CB") = VarCheckOrNot
               DrugTable.Rows.Add(DtRow)

               'fix - EH - 10/20/05
               DisplayCounter += 1
               'end fix

           Next

           DsDrugs.Tables.Add(DrugTable)
           UltraGrid1.SetDataBinding(DsDrugs, "Drug")

           UltraGrid1.DisplayLayout.Bands(0).ColHeadersVisible = False
           UltraGrid1.DisplayLayout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree
           UltraGrid1.DisplayLayout.AutoFitColumns = True
           UltraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False
           UltraGrid1.DisplayLayout.Override.RowSpacingAfter = 5

           For DrugLoop = 0 To UltraGrid1.Rows.Count - 1
               UltraGrid1.Rows(DrugLoop).Band.Columns(1).CellMultiLine = Infragistics.Win.DefaultableBoolean.True
               UltraGrid1.Rows(DrugLoop).Band.Columns(1).CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit
               UltraGrid1.Rows(DrugLoop).Band.Columns(0).Width = 10
               'TempStr = Convert.ToString(UltraGrid1.Rows(DrugLoop).Cells(1).Value)
               TempStr = UltraGrid1.Rows(DrugLoop).Cells(1).Text.ToString
               BooleanCheck = UltraGrid1.Rows(DrugLoop).Cells(0).Text.Equals("True").ToString

               If VarLoading = True Or Convert.ToBoolean(InStr(TempStr, "Transmit ")) = True Then

                   If Convert.ToBoolean(InStr(TempStr, "Transmit Fax by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.LightSkyBlue
                   ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Fax Success by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Green
                   ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Fax Failure by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Red
                   ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Green
                   ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print and Fax by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.LightSkyBlue
                   ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print and Fax Success by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Green
                   ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print and Fax Failure by: ")) = True Then

                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Red
                   Else
                       UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.White
                   End If
               Else
                   If Convert.ToBoolean(InStr(TempStr, "Transmit ")) = True And BooleanCheck = "True" Then

                       If Convert.ToBoolean(InStr(TempStr, "Transmit Fax by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.LightSkyBlue
                       ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Fax Success by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Green
                       ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Fax Failure by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Red
                       ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Green
                       ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print and Fax by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.LightSkyBlue
                       ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print and Fax Success by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Green
                       ElseIf Convert.ToBoolean(InStr(TempStr, "Transmit Print and Fax Failure by: ")) = True Then

                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.Red
                       Else
                           UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.White
                       End If
                       'UltraGrid1.Rows(DrugLoop).Cells(0).Appearance.BackColor = Color.LightSkyBlue
                       'UltraGrid1.Rows(DrugLoop).Cells(1).Appearance.BackColor = Color.LightSkyBlue
                   End If
               End If
           Next

           VarCheckBox.CheckAlign = ContentAlignment.TopCenter
           Me.UltraGrid1.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.RefreshDisplay)
       Catch ex As Exception
           LocalErrorLink.Error_Handler(ex)
       End Try
End Sub

 

Any help given is greatly appreciated.

Edited by PlausiblyDamp
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...