Solved

Combobox first use

Posted on 2006-12-01
8
161 Views
Last Modified: 2010-05-18
Hi

I have a problem with the first time that I click on a combobox.

I have
cmbDept.SelectedItem = NewItem
cmbDept.Text = NewItem

which is supposed to display the string in NewItem but it doesn't the first time it is clicked, it displays the first item in the list.
If it is clicked again it displays the string correctly.

All help appreciated.

Regards

0
Comment
Question by:alungwyther
8 Comments
 
LVL 6

Expert Comment

by:manch
ID: 18052585


Why don't u use directly

        cmbDept.SelectedItem = cmbDept.Items(indexOfItemUWantToSelect)

it will work surely

Try It
0
 

Author Comment

by:alungwyther
ID: 18052764
Hi

Thanks for the reply but it didn't work, still came up with the first item in the list.
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 18052880
Where are you running this code ?

So, as I can gather from your code you want to highlight the value of NewItem in the combo cmbDept ?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:dctuck
ID: 18052949
Try:

 cmbDept.Text = NewItem
0
 
LVL 6

Expert Comment

by:manch
ID: 18052983

Now u have to elaborate ur need

Where do u want to set the Item as First or Selected One
r u writing the code in the Event of the ComboBox itself or ur writing it in some other place
and what is ur basic need?

mention it
0
 

Author Comment

by:alungwyther
ID: 18053245
Hi

Solved the problem.
The combobox was not visible until after the text was set. Once I made it visible before then everything worked OK.
Thanks for the replies
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18088922
PAQd, 125 points refunded.

DarthMod
CS Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now