NullReferenceException

M

Martin

Hi All!

I'm developing an app in VB2005 for Windows Mobile 5.0 (compact framework).

I'm a beginner in VB.Net after years of programming in VB6 and its
predecessors.

Now I ran into a problem, which I can't solve.

In a module I made the following declarations:
Public BarcodeReader As Symbol.Barcode.Reader
Public BarcodeReaderData As Symbol.Barcode.ReaderData
Public BarcodeEvents As System.EventHandler

Then in the actual program (also a module) I do this:

Sub DoInit()

'Create new reader, first available reader will be used.
BarcodeReader = New Symbol.Barcode.Reader()

End Sub

Now I get a NullReferenceException and the message tells me to use the "New"
keyword...

Details:
System.NullReferenceException was unhandled
Message="NullReferenceException"
StackTrace:
at Symbol.Barcode.Reader..ctor()
at CocosOTR.TaskDriver.DoInit()
at CocosOTR.TaskDriver.Main()

But I did use the New keyword to create the instance. What am I doing wrong?

Hope someone can help...
Tia,
Martin
 
C

cod

Martin said:
But I did use the New keyword to create the instance. What am I doing wrong?

Hi,
now I have no symbol sdk on my pc, but I think that you must create an
instance of Symbol.Barcode.Reader from another object .. see the example
on symbol sdk ..

bye
cod
 
M

Martin

Hi Cod,

Thanks for your reply. I originally thought there was something wrong with
my statement, but it turns out that the NullreferenceException take place in
the Symbol classes. This happens when the system runs on a Non-Symbol
machine (thus without the barcode scanner present).

Thanks again for taking the time to respond,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top