G F

G F

  • NA
  • 44
  • 6k

Want to change the label of a Read Only Text box

Jan 21 2020 4:03 AM
Hi, 
 
I have a list box, lstjurisdictions, and when the form loads it loads records from a database.
When I select one of the items in the list box, I would like the label of a Text box to change instantly.
 
When I use the following code:
  1. private void lstJursdictions_SelectedIndexChanged(object sender, EventArgs e)  
  2. {  
  3. string curItem = lstJurisdictions.SelectedItem.ToString();  
  4. textBox3.Text = curItem;  
  5. }  
All I get is the message: System.Data.DataRowView 
as a label on the TextBox.
 
How can I get the Name of the label to change dynamically as the slected item from the list box changes?
 
Thank you! 

Answers (3)