468,727 Members | 1,513 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,727 developers. It's quick & easy.

Combo box with IDs - Repost with new question


I have a combo box and I can populate it with my class of dat
(the class allows me to store each userid,username called - see code below

I want the user to select the dropdown and see the username - but also determine the UserID from what was selected
(using DisplayName from the combo box??

I can populate the combo box without problems - BUT the user sees "System.object[]" in each item of the combobox not the username

***here is my clas
Public Class clsUser
Private msUserName As Strin
Private miUserID As Intege
Public Sub New(ByVal vsUserName As String, ByVal viUserID As Integer
msUserName = vsUserNam
miUserID = viUserI
End Su

Public Property UserName() As Strin
Ge
Return msUserNam
End Ge
Set(ByVal Value As String
msUserName = Valu
End Se
End Propert
Public Property UserID() As Intege
Ge
Return miUserI
End Ge
Set(ByVal Value As Integer
miUserID = Valu
End Se
End Propert
End Clas

thank yo
Gerry
Nov 20 '05 #1
2 1129
Thanks - that did the trick.

Regards,
Gerry
Nov 20 '05 #2
I think this'll work... add this to your class:

Public Overrides Function ToString() As String
Return msUserName
End Function
Josh Moody
Developer Division Sustained Engineering Team

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
Thread-Topic: Combo box with IDs - Repost with new question
thread-index: AcPgSqKPxNgaJVBmQwiw0Mj+5Pt6Xw==
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
From: "=?Utf-8?B?R2Vycnk=?=" <an*******@discussions.microsoft.com>
Subject: Combo box with IDs - Repost with new question
Date: Wed, 21 Jan 2004 10:16:05 -0800
Lines: 38
Message-ID: <1C**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.vb
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:174913
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I have a combo box and I can populate it with my class of data
(the class allows me to store each userid,username called - see code below)

I want the user to select the dropdown and see the username - but also
determine the UserID from what was selected.
(using DisplayName from the combo box??)

I can populate the combo box without problems - BUT the user sees
"System.object[]" in each item of the combobox not the usernames

***here is my class
Public Class clsUsers
Private msUserName As String
Private miUserID As Integer
Public Sub New(ByVal vsUserName As String, ByVal viUserID As Integer)
msUserName = vsUserName
miUserID = viUserID
End Sub

Public Property UserName() As String
Get
Return msUserName
End Get
Set(ByVal Value As String)
msUserName = Value
End Set
End Property
Public Property UserID() As Integer
Get
Return miUserID
End Get
Set(ByVal Value As Integer)
miUserID = Value
End Set
End Property
End Class

thank you
Gerry


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by ross | last post: by
1 post views Thread by Jeff Smith | last post: by
1 post views Thread by Steve B. | last post: by
5 posts views Thread by Adrian Parker | last post: by
reply views Thread by Ken Powers | last post: by
1 post views Thread by CARIGAR | last post: by
9 posts views Thread by bryonone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.