C# RadioButton列表选择特定索引
使用单选按钮列表的选定索引编写if语句时遇到问题。下面是我的代码C# RadioButton列表选择特定索引,c#,C#,使用单选按钮列表的选定索引编写if语句时遇到问题。下面是我的代码 if(radioButtonList.SelectedValue = 1){ //code } 我有一个包含3个不同索引的单选按钮列表。我怎么说ifselectedvalue=index[1]?试试这个 要设置索引,请执行以下操作: radioButtonList.SelectedIndex=index; 要设置值,请执行以下操作: radioButtonList.SelectedValue=val; 用于检查所选索引的
if(radioButtonList.SelectedValue = 1){
//code
}
我有一个包含3个不同索引的单选按钮列表。我怎么说ifselectedvalue=index[1]?
试试这个
要设置索引,请执行以下操作:
radioButtonList.SelectedIndex=index;
要设置值,请执行以下操作:
radioButtonList.SelectedValue=val;
用于检查所选索引的代码:
if(radioButtonList.SelectedIndex==index)
{
}
核对价值
if(radioButtonList.SelectedValue==val)
{
}