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
cboName.Enabled = False
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.
By Ernie in forum VB Classic
Last Post: 02-04-2003, 02:12 PM
By Patty_5 in forum VB Classic
Last Post: 05-22-2001, 08:55 AM
By Juan in forum VB Classic
Last Post: 01-27-2001, 12:17 AM
By Kevin McCormack in forum VB Classic
Last Post: 07-20-2000, 04:14 PM
By Jody Kelsch in forum authorevents.appleman
Last Post: 04-10-2000, 06:35 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center