albert albert

albert albert

  • NA
  • 524
  • 0

Error: De objectvariabele of With block-variabele is niet in

Mar 31 2014 2:39 AM
Hi everybody,
 
I have this:
 
[code]
 
 
Overridable Function getMachineInstallationData(ByVal pCompKey As Integer, ByVal pMachineInstallation_Key As Integer, ByRef Machine As TextBox, ByRef MachineLocation As TextBox) As Integer
Machine.Text = ""
MachineLocation.Text = ""
lblLastInstallationMaintenanceDate.Text = ""
Dim dataObj As New DataLayer.MachineInstallationData
If pMachineInstallation_Key = 0 Then 'Geen sleutel kijk of er maar één is
dataObj.GetRows(pCompKey)
Else
dataObj.GetRow(pMachineInstallation_Key)
End If
With dataObj
If .Count = 1 Then
txtMachineInstallatie.Text = .GetVal("MachineInstallation_Description")
txtMachineInstallation_Location.Text = .GetVal("MachineInstallation_Location")
If pMachineInstallation_Key <> 0 AndAlso (MachineInstallationKey.Value <> MachineInstallationKeySave.Value OrElse CInt("0" & MachineInstallationKey.Value) = 0) Then
txtInternal.Text &= vbCrLf & .GetVal("MachineInstallation_Remarks")
End If
MachineInstallationKey.Value = .GetVal("MachineInstallation_Key")
MachineInstallationKeySave.Value = .GetVal("MachineInstallation_Key")
If CDate(.GetVal("MachineInstallation_LastMaintenanceDate")) <> Date.MinValue Then
'lblLastInstallationMaintenanceDate.Text = CDate(.GetVal("MachineInstallation_LastMaintenanceDate")).ToShortDateString 'JV 2013-09-25
lblLastInstallationMaintenanceDate.Text = CDate(.GetVal("MachineInstallation_LastMaintenanceDate")).ToShortDateString & " / " & CDate(.GetVal("MachineInstallation_NextMaintenanceDate")).ToShortDateString
End If
End If
End With
'JK 20-3-2014 tooltip met onderhoudgrid laten zien
Dim tipTekst As String = ""
tipTekst = "<table width=380px>"
tipTekst &= "<tr >"
tipTekst &= "<td><b>" & getText(wForm, "tblType", "Type", Me.Page.ToString, Language) & "</b></td>"
tipTekst &= "<td><b>" & getText(wForm, "tblFrequentie", "Frequentie", Me.Page.ToString, Language) & "</b></td>"
tipTekst &= "<td><b>" & getText(wForm, "tblLaatste", "Laatste", Me.Page.ToString, Language) & "</b></td>"
tipTekst &= "<td><b>" & getText(wForm, "tblVolgende", "Volgende", Me.Page.ToString, Language) & "</b></td>"
tipTekst &= "<td></td>"
tipTekst &= "<td></td>"
tipTekst &= "<td></td>"
tipTekst &= "</tr>"
'BEGIN
'---- END
'Begin function:
'End Function
tipTekst &= "</table>"
If txtMachineInstallatie.Text <> "" Then
ToolTipOnderhoudInstal.TooltipText = tipTekst
End If
'laatst gepleegde onderhoud en eerstvolgende onderhoud laten zien.
If lblLastInstallationMaintenanceDate.Text = "" And txtMachineInstallatie.Text <> "" Then
objMaintenance.GetRows(, , "MaintenanceInstallationKey =" & MachineInstallationKey.Value, "MaintenanceLastDate Desc")
If objMaintenance.Count > 0 Then
lblLastInstallationMaintenanceDate.Text = CDate(objMaintenance.GetVal("MaintenanceLastDate")).ToShortDateString
End If
objMaintenance.GetRows(, , "MaintenanceInstallationKey =" & MachineInstallationKey.Value, "MaintenanceNextDate Asc")
If objMaintenance.Count > 0 Then
lblLastInstallationMaintenanceDate.Text &= " / " & CDate(objMaintenance.GetVal("MaintenanceNextDate")).ToShortDateString
End If
End If
'getMachineData(0, CInt(MachineKey.Value), txtMachine, txtMachineLocation)
Return dataObj.Count
End Function
Overridable Function objMaintenanceTooltip(ByRef machinekey As HtmlInputHidden) As Integer
Dim tipTekst As String = ""
Dim objMaintenance As New DataLayer.Maintenance
Dim objDataType As New DataLayer.ListData
Dim jobType As String
Dim frequency As String
Dim LastService As DateTime
Dim NextService As DateTime
objMaintenance.GetRows(, , "MaintenanceInstallationKey =" & MachineInstallationKey.Value, "MaintenanceNextDate Asc")
For Each oH As DataRow In objMaintenance.Rows
tipTekst &= "<tr>"
objDataType.GetRow(objMaintenance.GetVal("MaintenanceTypeKey", oH))
jobType = objDataType.GetVal("ListDetailDescription", oH)
objDataType.GetRow(objMaintenance.GetVal("MaintenanceFrequentyKey", oH))
frequency = objDataType.GetVal("ListDetailDescription", oH)
LastService = CDate(objMaintenance.GetVal("MaintenanceLastDate", oH)).ToShortDateString
NextService = CDate(objMaintenance.GetVal("MaintenanceNextDate", oH)).ToShortDateString
tipTekst &= "<td>" & jobType & "</td>"
tipTekst &= "<td>" & frequency & "</td>"
tipTekst &= "<td>" & LastService & "</td>"
tipTekst &= "<td>" & NextService & "</td>"
tipTekst &= "</tr>"
Next
End Function
[/code] 
 
 
 But I get this error:
 

De objectvariabele of With block-variabele is niet ingesteld.

Beschrijving: Er is een onverwerkte uitzondering opgetreden tijdens het uitvoeren van de huidige webaanvraag. Raadpleeg de stacktracering voor meer informatie over deze fout en de oorsprong ervan in de code.

Details van uitzondering: System.NullReferenceException: De objectvariabele of With block-variabele is niet ingesteld.

Fout in bron:

Regel 460:		'laatst gepleegde onderhoud en eerstvolgende onderhoud laten zien. Regel 461:		If lblLastInstallationMaintenanceDate.Text = "" And txtMachineInstallatie.Text <> "" Then Regel 462:			objMaintenance.GetRows(, , "MaintenanceInstallationKey =" & MachineInstallationKey.Value, "MaintenanceLastDate Desc") Regel 463:			If objMaintenance.Count > 0 Then Regel 464:				lblLastInstallationMaintenanceDate.Text = CDate(objMaintenance.GetVal("MaintenanceLastDate")).ToShortDateString

Bronbestand: D:\inetpub\wwwroot\_RSM_V39\RSM\RSM_V39\Meldingen\MeldingEdit.aspx.vb Regel: 462

Stacktracering:

Thank you 
 
 

Answers (2)