simple datagrid question

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

Me.DataGrid1.DataSource = Me.BarcodeReader1

After a barcodescan The value of :
Me.DataGrid1.Item(e.NewIndex - 1, 0)
is "1234567"
for example.
After grabbing that value I want to set the value in
Me.DataGrid1.Item(e.NewIndex - 1, 0) to ""
Every attempt to set the value results in a run time error but it's not
telling me why. I've googled, search these archives, looked in two books
and can't find where the datagrid's cell can be set to a different value.

Tried

Me.DataGrid1.Item(0, 0) = ""
DataGrid1(0, 0) = ""

Nothing works. Do i need to set another property first??

TIA
Harry
 
That's probably because BarcodeReader1 does not implement IList or
IListSource (why would it?).

By the way, what exactly you're expecting to see in the DataGrid with
BarcodeReader as a data source?
I'd say at most BarcodeReader would provide you with one barcode, so it
makes sense to bind it to TextBox.

If you need to scan bunch of codes and put them in some data base, you have
to use appropriate storage.
Consider using ArrayList.
DataSet and/or SQL CE are good options if you need to store more than just
bar codes.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Actually, as hard it is to believe, it does implement IList. Symbol people
chose rather strange data model, where BarcodeReader class is actually a
collection class.

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Ilya Tumanov [MS]" said:
That's probably because BarcodeReader1 does not implement IList or
IListSource (why would it?).

By the way, what exactly you're expecting to see in the DataGrid with
BarcodeReader as a data source?
I'd say at most BarcodeReader would provide you with one barcode, so it
makes sense to bind it to TextBox.

If you need to scan bunch of codes and put them in some data base, you
have
to use appropriate storage.
Consider using ArrayList.
DataSet and/or SQL CE are good options if you need to store more than just
bar codes.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "Harry Simpson" <[email protected]>
Subject: simple datagrid question
Date: Tue, 25 Jan 2005 11:12:43 -0600
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 66.89.73.130.ptr.us.xo.net 66.89.73.130
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69649
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Me.DataGrid1.DataSource = Me.BarcodeReader1

After a barcodescan The value of :
Me.DataGrid1.Item(e.NewIndex - 1, 0)
is "1234567"
for example.
After grabbing that value I want to set the value in
Me.DataGrid1.Item(e.NewIndex - 1, 0) to ""
Every attempt to set the value results in a run time error but it's not
telling me why. I've googled, search these archives, looked in two books
and can't find where the datagrid's cell can be set to a different value.

Tried

Me.DataGrid1.Item(0, 0) = ""
DataGrid1(0, 0) = ""

Nothing works. Do i need to set another property first??

TIA
Harry
 
The reason you cannot change the grid cell is because it is bound to the
object that implements IBindingList interface and returns false in the
AllowEdit property. When the grid is bound, attempts to change the cell
value result in associated data source being edited. If the data source does
not allow edits, cell update fails.

My personal take on the BarcodeReader class is that it hardly can be used as
it is. Consider using Reader class directly instead.
If you insist on using BarcodeReader, don't bind it to controls. Instead add
a handler to ListChanged event and read all the data once event is fired,
then clear list.
 
Oh, really? I guess my imagination is way too limited.

There are more things in heaven and earth, Horatio,
Then are dreamt of in your philosophy...

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Alex Feinman [MVP]" <[email protected]>
References: <[email protected]>
Subject: Re: simple datagrid question
Date: Wed, 26 Jan 2005 01:09:40 -0800
Lines: 78
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="Windows-1252";
reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 204.249.181.133
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
..phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69741
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Actually, as hard it is to believe, it does implement IList. Symbol people
chose rather strange data model, where BarcodeReader class is actually a
collection class.

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Ilya Tumanov [MS]" said:
That's probably because BarcodeReader1 does not implement IList or
IListSource (why would it?).

By the way, what exactly you're expecting to see in the DataGrid with
BarcodeReader as a data source?
I'd say at most BarcodeReader would provide you with one barcode, so it
makes sense to bind it to TextBox.

If you need to scan bunch of codes and put them in some data base, you
have
to use appropriate storage.
Consider using ArrayList.
DataSet and/or SQL CE are good options if you need to store more than just
bar codes.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "Harry Simpson" <[email protected]>
Subject: simple datagrid question
Date: Tue, 25 Jan 2005 11:12:43 -0600
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 66.89.73.130.ptr.us.xo.net 66.89.73.130
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:69649
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Me.DataGrid1.DataSource = Me.BarcodeReader1

After a barcodescan The value of :
Me.DataGrid1.Item(e.NewIndex - 1, 0)
is "1234567"
for example.
After grabbing that value I want to set the value in
Me.DataGrid1.Item(e.NewIndex - 1, 0) to ""
Every attempt to set the value results in a run time error but it's not
telling me why. I've googled, search these archives, looked in two books
and can't find where the datagrid's cell can be set to a different value.

Tried

Me.DataGrid1.Item(0, 0) = ""
DataGrid1(0, 0) = ""

Nothing works. Do i need to set another property first??

TIA
Harry
 
Back
Top