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...
 
Back
Top