>// Get the index of the row that should be preselected >for (Index=0;Index<this.cboClients.Items.Count;Index++) >{ > // Check if ddl contents matches a field from a table stored in a Data Reader > if ((string)dr["clientno"] == this.ddlClients.Items[Index].Value) > { > break; > } >} > >if (Index<this.ddlClients.Items.Count) >{ > this.ddlClients.SelectedIndex = Index; >} >>
>>Sub GetUserUpdate() >> ' Update and fill ddlUsers after new User is Added... >> Dim SqlSelectCommand1 As New System.Data.SqlClient.SqlCommand() >> SqlSelectCommand1.CommandText = "SELECT UserID FROM UserInfo ORDER BY UserID" >> SqlSelectCommand1.Connection = SqlConnection1 >> >> Dim cmdUserID >> cmdUserID = SqlSelectCommand1.ExecuteReader() >> >> ddlUsersID.DataSource = cmdUserID >> ddlUsersID.DataTextField = "UserID" >> >> ddlUsersID.DataBind() >> SqlConnection1.Close() >> >>End Sub >>>>