|
-
Help with .Net combo box
I have a combo box on a form called cboName, already populated with nine names. Nothing is visible in the text portion of the combo box yet. I only want the combo box enabled if the logged on user is one of the nine names. I want the code to loop thru the names and compare them to the logged on user and then enable or disable the combo box (as part of the form load, or very early in the code before the user gets to the combo box). What properties of the combo box do I use to get the text of the names that I originally added using Items.Add so that I can Loop through to compare to the name of the user? Some form of SelectedIndex? Some form of SelectedItem?
I think I should use something like
If cboName.XXX = GetUserName(gUserName) Then
cboName.Enabled = True
Else
cboName.Enabled = False
EndIf
In this example, gUserName would be tjones, his login name to the system. Timothy Jones would be the corresponding name in the combo box which was added earlier in another part of the code, and which would be returned by the GetUserName function.
But I cannot seem to get the XXX to come up with text name equal to the name (Timothy Jones) that I added with Items.Add. This has got to be simple, but I'm just missing it somewhere.
Can anyone help me here?
TIA for anything anyone can offer.
Similar Threads
-
By Ernie in forum VB Classic
Replies: 2
Last Post: 02-04-2003, 01:12 PM
-
By Patty_5 in forum VB Classic
Replies: 0
Last Post: 05-22-2001, 07:55 AM
-
By Juan in forum VB Classic
Replies: 0
Last Post: 01-26-2001, 11:17 PM
-
By Kevin McCormack in forum VB Classic
Replies: 4
Last Post: 07-20-2000, 03:14 PM
-
By Jody Kelsch in forum authorevents.appleman
Replies: 1
Last Post: 04-10-2000, 05:35 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks