try
{
DataRowView drv = attDataGrid.SelectedItem as DataRowView;
att_id = Convert.ToInt32(drv.Row[0].ToString());
attComboBox.SelectedItem = drv.Row[1].ToString();
rdata = drv.Row[2].ToString(); ;
attDetail.Text = drv.Row[4].ToString();
DateTime sdt = dc.changeDateG(drv.Row[3].ToString());
if(rdata.Equals("حاضر"))
{
attPre.Checked = true;
}
else {
attUp.Checked = true;
}
try
{
attDate.SelectedDate = sdt;
}
catch (FormatException)
{
MessageBox.Show(sdt.ToString());
}
}
catch(NullReferenceException)
{
}
我正在尝试设置我的attPre单选按钮,但是visual studio将其视为错误任何想法如何处理此错误???
答案 0 :(得分:3)
可能是因为你做比较而不是作业
使用此:
Vector3 GetDesiredPosition()
{
Position = new Vector3(0, 0, 0);
for (int i = 0; i == ControllsHolder.PlayerList.Count-1; i++) //When multiple players in list it sets position to 0 for some reason?
{
if (ControllsHolder.PlayerList[i].Alive)
Position = new Vector3(Position.x + ControllsHolder.PlayerList[i].transform.position.x, Position.y + ControllsHolder.PlayerList[i].transform.position.y, 0);
else continue;
}
Position = new Vector3(Position.x / (ControllsHolder.PlayerList.Count),Position.y/(ControllsHolder.PlayerList.Count),0);
return Position;
}
attPre.Checked = true;
答案 1 :(得分:0)
我已经找到了如何处理它
RadioButton pr = attPre as RadioButton;
pr.IsChecked = true;