How do you highlight/preselect items in a C# ListBox and where is the best place in the code to do so – Form_Load, Control_Load methods?
Here is the code that I tried but it did not work:
public frmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//Fill in lists ******* Is there a better place to do this? *************
//lstFrom.SelectedIndex = 1;
lstFrom.Items.Add("BTU/min");
. . . . . . . . .
lstFrom.SetSelected(1,true);
lstFrom.Update();
Here is the code that I tried but it did not work:
public frmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//Fill in lists ******* Is there a better place to do this? *************
//lstFrom.SelectedIndex = 1;
lstFrom.Items.Add("BTU/min");
. . . . . . . . .
lstFrom.SetSelected(1,true);
lstFrom.Update();