Jonathan Chavez
Jonathan Chavez

Reputation: 1

Set selected value in Combox according to selected record

I have two tables, lets say tableX and TableY, and I have one form in Visual Studio 2022 to edit/create new records in table X. I have one field in table X that come from table Y, let's say IDY, to choose that field I have added all the items in a combobox using sqldatareader command, but the problem is when I choose one item from TableX that is already created (to edit), I want that the "default" value in the combobox be the value from the selected record that the user wants to edit.

I don't know if there is a command to make this, I thought to use SelectedIndex property in a For cycle with a size of the counted rows from the TableY to check one by one the items of the combobox. But I think there's should be a easiest way to do it.

Thanks in advance.

Upvotes: -2

Views: 21

Answers (0)

Related Questions