PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Barcode scanning on Symbol MC70 ???

Reply

Barcode scanning on Symbol MC70 ???

 
Thread Tools Rate Thread
Old 22-06-2007, 02:24 PM   #1
naimish_hit
Junior Member
 
Join Date: Jun 2007
Posts: 3
Trader Rating: (0)
Question Barcode scanning on Symbol MC70 ???


Hi,

I am .NET developer and recently I have got chance to work on Windows Mobile 5.0 and very first application I have got is to scan barcode using symbol MC70 device. I grade my self as a beginner in WM 5.0.

So far I have installed Symbol Mobility SDK 1.5 for .NET and created a prototype for barcode scanning. Inititally I was just testing it on emulator and it was giving me NullReference exception in following line:
barcode1.Reader.Actions.Read(this.symReader);


Then I deployed on actual device, i.e. Symbol MC70 but again result was same.

Now I could not figure out that why its throwing NullReference exception. My code is given below:

I would appreciate if anyone helps me.

Thanks in advance,

My Code:

frmBarcodeScanning.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BarcodeScanning
{
public partial class frmBarcodeScanning : Form
{
private Symbol.Barcode.ReaderData symReader;

public frmBarcodeScanning()
{
InitializeComponent();
}

privatevoid menuItem1_Click(object sender, EventArgs e)
{
this.Close();
}

privatevoid button1_Click(object sender, EventArgs e)
{
}

privatevoid barcode1_OnStatus(object sender, Symbol.Barcode.BarcodeStatus barcodeStatus)
{
label2.Text += barcodeStatus.Text;
}

privatevoid barcode1_OnRead(object sender, Symbol.Barcode.ReaderData readerData)
{
try
{
switch (readerData.Result)
{
case Symbol.Results.SUCCESS:
listBox1.Items.Add(
"Barcode Device: " + readerData.Source.ToString());
listBox1.Items.Add(
"Data Read: " + readerData.Text.ToString());
listBox1.Items.Add(
"------------------");
this.ReadData();
break;
default:
listBox1.Items.Add(
"No data was read.");
listBox1.Items.Add(
"Status of Read: " + readerData.Result.ToString());
listBox1.Items.Add(
"------------------");
break;
}
}
catch (Exception ex)
{
listBox1.Items.Add(ex.Message.ToString());
listBox1.Items.Add(
"------------------");
}
}

privatebool InitReader()
{
try
{
this.symReader = new Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text, Symbol.Barcode.ReaderDataLengths.MaximumLabel);

barcode1.EnableScanner = true;

returntrue;
}
catch (Exception ex)
{
returnfalse;
}
}

privatevoid ReadData()
{
barcode1.Reader.Actions.Read(
this.symReader);
}

privatevoid cmdRead2_Click(object sender, EventArgs e)
{
barcode1.Reader.Actions.ToggleSoftTrigger();
}

privatevoid cmdRead3_Click(object sender, EventArgs e)
{
barcode1.Reader.Actions.Flush();
}

privatevoid frmBarcodeScanning_Load(object sender, EventArgs e)
{
if (this.InitReader())
{
this.ReadData();
}
}

privatevoid label2_ParentChanged(object sender, EventArgs e)
{
}
}
}

Regards,

Naimish

Last edited by naimish_hit : 22-06-2007 at 02:31 PM.
naimish_hit is offline   Reply With Quote
Old 04-07-2007, 11:25 AM   #2
naimish_hit
Junior Member
 
Join Date: Jun 2007
Posts: 3
Trader Rating: (0)
Default

anyone helping me here ?
naimish_hit is offline   Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off