Hi all,
Well I abandoned the use of a datagrid in my windows form and have opted to
use a listbox instead.
I have, following a helpful article created an item class and loaded it with
values from an ADO recordset.
Now, if I read the data I get a field (clientid) looking like this;
{FE84ACD5-8263-11D7-B0E7-0080AE000001}
when in fact, the actual data (as viewed using say a binding to a datagrid)
looks like this;
fe84acd5-8263-11d7-b0e7-0080ae000001
Why is it placing {} around the string and CASING up?
AAARRRRGGGHHHH!!
Here's some code snippets - where could this be happening?
By the way - I'm forced to use ADO as the dataaccess method in this case -
it is pulled from a 3rd-party reference which returns an ADO recordset.
I guess I could load the data into a dataset prior to reading - but then I'm
not sure how I read through the set sequentially.....
The defined class:-
Private clientid As String
Private Class ClientListItem
Private clientid As String
Private clientname As String
Public Sub New(ByVal id As String, ByVal name As String)
clientid = id
clientname = name
End Sub
Public Property listclientid() As String
Get
Return clientid
End Get
Set(ByVal Value As String)
clientid = Value
End Set
End Property
Public Property listclientname() As String
Get
Return clientname
End Get
Set(ByVal Value As String)
clientname = Value
End Set
End Property
Public Overrides Function ToString() As String
' this can be whatever you want to show in the listbox
Return clientname & " " & clientid
End Function
End Class
And here's the loading of the data into the listbox;
If rsclients.State <> ADODB.ObjectStateEnum.adStateClosed Then
rsclients.MoveFirst()
While Not rsclients.EOF
id = Trim(rsclients.Fields(0).Value)
name = rsclients.Fields("clientname").Value
' Debug.WriteLine(rsclients.Fields("clientid").Value & " " &
rsclients.Fields("clientname").Value)
' Debug.WriteLine(id.ToString & " " & name.ToString)
Dim liclients As New ClientListItem(id.ToString, name.ToString)
lstClients.Items.Add(liclients)
rsclients.MoveNext()
End While
End If
If anyone has any ideas I'd appreciate it.
Thanks,
Graham 2 1083
Ok.. Ok... yep.. I got it... GUID.....
Thanks, for anyone that already took the time to reply......
Graham
"Graham Blandford" <gr**************@sympatico.ca> wrote in message
news:qn*********************@news20.bellglobal.com ... Hi all,
Well I abandoned the use of a datagrid in my windows form and have opted
to use a listbox instead.
I have, following a helpful article created an item class and loaded it
with values from an ADO recordset.
Now, if I read the data I get a field (clientid) looking like this;
{FE84ACD5-8263-11D7-B0E7-0080AE000001}
when in fact, the actual data (as viewed using say a binding to a
datagrid) looks like this;
fe84acd5-8263-11d7-b0e7-0080ae000001
Why is it placing {} around the string and CASING up? AAARRRRGGGHHHH!!
Here's some code snippets - where could this be happening?
By the way - I'm forced to use ADO as the dataaccess method in this case - it is pulled from a 3rd-party reference which returns an ADO recordset. I guess I could load the data into a dataset prior to reading - but then
I'm not sure how I read through the set sequentially.....
The defined class:-
Private clientid As String Private Class ClientListItem Private clientid As String Private clientname As String Public Sub New(ByVal id As String, ByVal name As String) clientid = id clientname = name End Sub Public Property listclientid() As String Get Return clientid End Get Set(ByVal Value As String) clientid = Value End Set End Property Public Property listclientname() As String Get Return clientname End Get Set(ByVal Value As String) clientname = Value End Set End Property Public Overrides Function ToString() As String ' this can be whatever you want to show in the listbox Return clientname & " " & clientid End Function End Class And here's the loading of the data into the listbox;
If rsclients.State <> ADODB.ObjectStateEnum.adStateClosed Then rsclients.MoveFirst() While Not rsclients.EOF id = Trim(rsclients.Fields(0).Value) name = rsclients.Fields("clientname").Value ' Debug.WriteLine(rsclients.Fields("clientid").Value & " " & rsclients.Fields("clientname").Value) ' Debug.WriteLine(id.ToString & " " & name.ToString) Dim liclients As New ClientListItem(id.ToString, name.ToString) lstClients.Items.Add(liclients) rsclients.MoveNext() End While End If
If anyone has any ideas I'd appreciate it.
Thanks, Graham
Datagrid columns will call the ToString() method of the datatype (which all
have in .NET since they all derive from object). Thats how you get your
display
In your case, your using a GUID which when calling the ToString() removes
the {}'s
"Graham Blandford" <gr**************@sympatico.ca> wrote in message
news:qn*********************@news20.bellglobal.com ... Hi all,
Well I abandoned the use of a datagrid in my windows form and have opted
to use a listbox instead.
I have, following a helpful article created an item class and loaded it
with values from an ADO recordset.
Now, if I read the data I get a field (clientid) looking like this;
{FE84ACD5-8263-11D7-B0E7-0080AE000001}
when in fact, the actual data (as viewed using say a binding to a
datagrid) looks like this;
fe84acd5-8263-11d7-b0e7-0080ae000001
Why is it placing {} around the string and CASING up? AAARRRRGGGHHHH!!
Here's some code snippets - where could this be happening?
By the way - I'm forced to use ADO as the dataaccess method in this case - it is pulled from a 3rd-party reference which returns an ADO recordset. I guess I could load the data into a dataset prior to reading - but then
I'm not sure how I read through the set sequentially.....
The defined class:-
Private clientid As String Private Class ClientListItem Private clientid As String Private clientname As String Public Sub New(ByVal id As String, ByVal name As String) clientid = id clientname = name End Sub Public Property listclientid() As String Get Return clientid End Get Set(ByVal Value As String) clientid = Value End Set End Property Public Property listclientname() As String Get Return clientname End Get Set(ByVal Value As String) clientname = Value End Set End Property Public Overrides Function ToString() As String ' this can be whatever you want to show in the listbox Return clientname & " " & clientid End Function End Class And here's the loading of the data into the listbox;
If rsclients.State <> ADODB.ObjectStateEnum.adStateClosed Then rsclients.MoveFirst() While Not rsclients.EOF id = Trim(rsclients.Fields(0).Value) name = rsclients.Fields("clientname").Value ' Debug.WriteLine(rsclients.Fields("clientid").Value & " " & rsclients.Fields("clientname").Value) ' Debug.WriteLine(id.ToString & " " & name.ToString) Dim liclients As New ClientListItem(id.ToString, name.ToString) lstClients.Items.Add(liclients) rsclients.MoveNext() End While End If
If anyone has any ideas I'd appreciate it.
Thanks, Graham
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Cedric |
last post by:
This is a 3 weeks old problem, but having found a solution (and having
looked for one here, finding only this message), I'm replying now.
From: Jive (someone@microsoft.com)
Subject: Upgrade...
|
by: Angel Cat |
last post by:
Trying to get my jobs to send mail when job fails. Should be easy but
it's giving me headache
Had a whole slew of issues. Outlook is installed with a n outlook
mail profile set up that can...
|
by: Andrew Thompson |
last post by:
- NN 4.78 rendering woes, links at far left -
I am trying to rework an old site, make it valid html
and css, improving the x-browser and 'older browser'
compatibility. My efforts so far, have...
|
by: John Hopper |
last post by:
I use an xsd and the xsd Object Generator tool from codeProject to generate a
serializable "report" class in my web service. One particular element in the
xsd, from which a public property is...
|
by: Johnathan Doe |
last post by:
I am trying to do some bit fiddling with unsigned chars. Don't ask me
why I am doing this, I don't know. It's just an exercise. :)
Here's what I am trying to do: I have one unsigned char of a...
|
by: Bob Hollness |
last post by:
Hi all.
Is it possible to store some additional information in each node of a
treeview but without displaying it?
i.e. If, for example, my treeview displayed a list of products. But...
|
by: William Buchanan |
last post by:
Hi folks
I have a "Search" text box and LinkButton in my master page. When this is
submitted, I do a Server.Transfer to a page which contains a gridview. The
gridview is filtered on a hidden...
|
by: Mark Rae |
last post by:
Hi,
This time, I'm looking for a regular expression which says "the string must
contain exactly seven or exactly eight digits" e.g.
123456 fails
1234567 passes
12345678 passes
123456789...
|
by: Michael B. Trausch |
last post by:
I am attempting to piece together a Python client for Fotobilder, the
picture management server on Livejournal.
The protocol calls for binary data to be transmitted, and I cannot seem
to be able...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |