Setting the ComboBox Selected Item Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How come on a button event I can run the following code:

vehicleRequired.DataSource = vehicleList; // vehicleList is just an array
value
vehicleRequired.SelectedItem = null;

but running the same code on the window load or constructor event, does not
set the selected Item to null, but defaults the first item in the array?
 
use SelectedIndex property instead
vehicleRequired.SelectedIndex=-1;
Good Works....

Serkan DIRIARIN
Application Developer,MCP,MCP.NET
Disturb Me For These Subjects
----------------------------------------------------------------
C/C++, General .NET, VB.NET, VC#.NET, VC++.NET, Smart Devices, Longhorn
COM, COM+, VB6, VC++ 6, eVB, eVC++, SQL Server, .NET Remoting,
Whidbey, ASP, ASP.NET, XML Web Services, Smart Phones, Series 60 PLT,
C++ Builder, Compiler Design, Cyber Systems, Low-Level System Functions
YACC, Lex, Query Techs, System Programming, etc...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top