472,958 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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 1267
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ross | last post by:
A couple of times I have had to implement a VB style combo box (i.e. text entry or drop down selection) under IE. I keep having to recreate the following code from scratch, so I thought I'd post it...
3
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
1
by: Jeff Smith | last post by:
Hi This is a repost due to no responses Here's a problem I've encountered with Access 2003 which has got me to redesign how I get the row source in a second combo box using the first combo...
8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
1
by: Steve B. | last post by:
Why can't I obtain the values from a DS table in a combo box after I select the proper DS table (DataSource) and display member in the CB VS property window. However, I can operate the CB drop down...
5
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
0
by: Ken Powers | last post by:
Hello everyone, Sorry about the repost, my second VB.NET App is done with the exception of this error. I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! ...
17
by: Aussie Rules | last post by:
Hi, I want to have a single line combo box dropdown, but where i can selected multiple items in the drop down via a check box... I can see one in the standard tool box... is there one ? If...
1
by: Shawn Yates | last post by:
It has been a while since I have done anything on MS Access and I seem to be a bit rusty. I hope someone could help me solve my issue. I have a form that has multiple combo boxes on it. Each box...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.