Friday 15 June 2012

vb.net - How can I set the text for a label equal to the selected Item of a databound listBox? -


I set ValueMember for DisplayMember and "EmpID" columns for the ListBox for the "Employee" column. The list box stays fine, but the label never changes. I'm new on this and can not understand what I'm missing. Here is my code:

  Me.EmployeeTableAdapter.Fill (Me.TimeCards2DataSet.Employee) Label1.Text = lstEmployees.Selected.ToString    

You are probably looking for an index-playable event:

  Private sub-listpermessic index ( The sender in the form of the object, and event as an ARG) _LSEMFiGe are selected. The selected index changes if LSEMA employees. If selected, then there is nothing label 1. Text = string Leave blank label 1 text = lstEmployees.Verue selected.Stressing end and end   

Alternatively, if using data binding: / P>

  Label1 .DataBindings.Add ("Text", Me.TimeCards2DataSet.Employee, "Employee")    

No comments:

Post a Comment