beingsultanak
New member
- Joined
- Aug 18, 2020
- Messages
- 1
- Programming Experience
- Beginner
In the load event I managed to set the autocomplete source of Part Number txtBox. I want to auto fill Description text box based on the value of Part Number textbox. How can i do?
C#:
try
{
string query = "select [itmPartNumber],[itemDescr] from [vstItems]";
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
SqlDataReader sdr = cmd.ExecuteReader();
AutoCompleteStringCollection autoPart = new AutoCompleteStringCollection();
while (sdr.Read())
{
autoPart.Add(sdr.GetString(0));
} sdr.Close();
txtPartNum.AutoCompleteMode = AutoCompleteMode.Suggest;
txtPartNum.AutoCompleteSource = AutoCompleteSource.CustomSource;
txtPartNum.AutoCompleteCustomSource = autoPart;
}
Last edited by a moderator: