Solved

Combobox first use

Posted on 2006-12-01
8
164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do sunrise and sunset times change with altitude 14 46
VB.NET Textbox input validation 4 65
Code enhancement 4 33
Convert VB web project to C# 3 38
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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