how to bind data from a model to a text-box instead of a list-box

  • Thread starter Rickal Hamilton
  • Start date

Rickal Hamilton

i get data from my database through means of dapper and a data model i then bind that data to a list box and it all works fine but now i want to bind that data to a text-box. previously i would just get the data bind it to a hidden list-box and then get that data from the list box but i now want to learn how to do this correctly.

//this is my current workaround.
textBox1.Text = description.GetItemText(description.SelectedItem);

i have also tried to bind the load-inventory to text-box but that doesn't work.

//datamodel prop
description.DataSource = loadinventory;

//datamodel full prop
description.DisplayMember = "ItemDescription";

textBox1.DataSource = loadinventory;//This does not work
textBox1.DisplayMember = "ItemDescription";//This does not work

i want to pull data from my database using data-models and dapper to my text-box and other variables.

Continue reading...