Object not defined

  • Thread starter Thread starter cmdolcet69
  • Start date Start date
C

cmdolcet69

I have a form that will log a serial print number into a object once
sampled.I call a new form when my users samples the value and on the
new form it will give me an option to reprint the serial number, what
happens is that when i get to the new form it will trigger an error
object reference not set to an instance of an object.

The Public scantuntime as frmnewruntime is the original form where i
hot the sample button on the form. Once the sample button is pushed it
will call the PrintBarcodeLabel (). If the barcode is wrong then I
want to reprint the bar code which i call it in the
scanruntime.PrintBarcodeLabel(). But i get the above error, how can i
avoid this?



Public Class dlgBarCodeScanner
Public scanruntime As frmNewRuntime
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
scanruntime.PrintBarcodeLabel()
End Sub
End Class
 
cmdolcet69 said:
I have a form that will log a serial print number into a object once
sampled.I call a new form when my users samples the value and on the
new form it will give me an option to reprint the serial number, what
happens is that when i get to the new form it will trigger an error
object reference not set to an instance of an object.

The Public scantuntime as frmnewruntime is the original form where i
hot the sample button on the form. Once the sample button is pushed it
will call the PrintBarcodeLabel (). If the barcode is wrong then I
want to reprint the bar code which i call it in the
scanruntime.PrintBarcodeLabel(). But i get the above error, how can i
avoid this?



Public Class dlgBarCodeScanner
Public scanruntime As frmNewRuntime
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
scanruntime.PrintBarcodeLabel()
End Sub
End Class

You don't show where you are setting scanruntime to an object. You should
be doing "something" like this:

dim ui as New dlgBarCodeScanner
ui.scanruntime = SomeUIObject ' I don't know what you want it set to...
ui.Show()
 
Back
Top