What I’d like to do is once the user has selected an item from the combo box, for it to then populate the text boxes with the corresponding data.
The error’s I’m getting are:
The best overloaded method match for
‘System.Collections.Generic.List.this[int]’ has
some invalid arguments
and
Argument ‘1’: cannot convert from ‘object’ to ‘int’
Here is a section of my code:
List<Venue> Ven = new List<Venue>();
private void cboVenue_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
txtVenue.Text = Ven[cboVenue.SelectedItem].m_VenName;
}
catch
{
}
}
Please, any help would really be appreciated. Thanks
Try SelectedIndex instead of SelectedItem. it’s integer.