Combo box with IDs - Repost with new question

G

Guest

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
 
J

Josh Moody [MSFT]

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=?=" <[email protected]>
Subject: Combo box with IDs - Repost with new question
Date: Wed, 21 Jan 2004 10:16:05 -0800
Lines: 38
Message-ID: <[email protected]>
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
 

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