Hello people,

I am having problems binding a listbox to an array.
Using Visual Studio 2003 with framework 1.1

That's the array:

internal class Data
{
private Data() {} // static class
public static readonly string[] states =3D { "Alabama", =
"Alaska", "Arizona", /* ...*/ "Wisconsin", "Wyoming"};
}

I also have a listbox on a form. The auto-generated code is:

// listStates
this.listStates.Name =3D "listStates";
this.listStates.TabIndex =3D 0;
this.listStates.Location =3D new System.Drawing.Point(8, 16);
this.listStates.Size =3D new System.Drawing.Size(100, 82);
this.listStates.SelectionMode =3D =
System.Windows.Forms.SelectionMode.MultiSimple;

Question number 1:
In the designer, the DataSource property of the listStates ListBox is =
not editable.
I would like to bind it to the array at design time but I cannot.
I that supposed to be like that or am I missing something?

Question number 2:
When I added the following statement
listStates.DataSource =3D Data.states;
it appeared to work but I started having weird behaviour regarding the =
selection.
In particular, after selecting several items and unselecting all of =
them, the first item would become selected.
What am I doing wrong?

Thank you,
Alex.

--=20
Please replace myrealbox with alexoren to reply by email.