提示字符串格式不正确
private void cmb2_SelectedIndexChanged(object sender, EventArgs e)
{
string id = cmb2.SelectedValue.ToString();
foreach(Friend f in friends)
{
if (f.iID ==Convert.ToInt32( id))//这里有一个问题 说字符串格式不正确!!!
{
txtid.Text = f.iID.ToString();
txtname.Text = f.sName;
txttel.Text = f.sTel;
txtmob.Text = f.sMob;
txtdanwei.Text = f.sDanwei;
txtadress.Text = f.sAdress;
txtqq.Text = f.sQQ;
txtemail.Text = f.sEmail;
}
}
}
------解决方案--------------------如果你单单要cmb中的序号的话改成:
string id = cmb2.SelectedIndex.ToString();