Solved

Combobox first use

Posted on 2006-12-01
8
160 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
Comment Utility


Why don't u use directly

        cmbDept.SelectedItem = cmbDept.Items(indexOfItemUWantToSelect)

it will work surely

Try It
0
 

Author Comment

by:alungwyther
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 7

Expert Comment

by:dctuck
Comment Utility
Try:

 cmbDept.Text = NewItem
0
 
LVL 6

Expert Comment

by:manch
Comment Utility

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
Comment Utility
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
Comment Utility
PAQd, 125 points refunded.

DarthMod
CS Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 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

15 Experts available now in Live!

Get 1:1 Help Now