2
When save a dice in the combo box, and in this combo box has two options (gasoline, diesel, alcohol, natural gas)
When I select diesel and save it works normally.
The problem is when I want to load the saved combo box always appears the first value of the combo, ie gasoline.
How do I stop when the user loads the information he can see in the combo box the value selected by him?
The code is below
public frmCadVeiculo2()
{
InitializeComponent();
List<Combustivel> itens = new List<Combustivel>();
itens.Add(new Combustivel() { IDCombustivel = "Ga", Nome = "Gasolina" });
itens.Add(new Combustivel() { IDCombustivel = "Di", Nome = "Diesel" });
itens.Add(new Combustivel() { IDCombustivel = "Al", Nome = "Álcool" });
itens.Add(new Combustivel() { IDCombustivel = "GN", Nome = "Gás Natural" });
cbTipoCombustivel.DataSource = itens;
cbTipoCombustivel.ValueMember = "IDCombustivel";
cbTipoCombustivel.DisplayMember = "Nome";
}
Hi Tiago, blza? First of all thank you very much for the help, sanou 70%, but I have one more question, this Lerdafontededados() would be the list of items?
– Danillo Victtor
This Pathfinder method() If the data source is the list How would you implement this method?
– Danillo Victtor
Got it, solved the problem, thank you very much
– Danillo Victtor
The list is a data source of options the way you did it right, but now you need a user data source. For example: you need to persist user data, so when it reopens your app it will read from this data source (can be file, database and etc...) and will show the user the selection of it.
– Tiago S
Got it, solved the problem, thank you very much
– Danillo Victtor