Preselect a multi simple listbox from a datareader
Hey guys an absolute new c# developer
I can't figure this out so please help
this.sqlConnection1.Open ();
SqlDataReader dr;
dr = this.cmdselected.ExecuteReader();
while (dr.Read())
{
if( Convert.ToInt32(dr["SupplierId"]) == 3)
{
int indexnew = this.listBox1.Items.IndexOf (dr["ProductName"]);
this.listBox1.SetSelected (indexnew,true);
}
}
dr.Close ();
this.sqlConnection1.Close();