我在用C#中的/* This condition will ariese when we will read the values from property file and there a change to use this value in static area */
@Component
public class Employee{
String name="radhe";
}
public class Address{
@Autowired
Employee employee;
public static void display(){
employee.name;
}
}
挣扎
CheckBox
因此,这段代码返回了带有一些复选框的对象列表,当我单击“确认”按钮时,我想选中该复选框,所以我想这样做:
public formPCRBaseline(List<GetBaselineSectionTasks> m_objPCRCheck)
{
setDefaults(m_objPCRCheck);
}
private void setDefaults(List<GetBaselineSectionTasks> m_objPCRCheck)
{
richTextBoxPCRBaseline.BackColor = Color.White;
foreach (GetBaselineSectionTasks i_objPCRCheck in m_objPCRCheck)
{
richTextBoxPCRBaseline.SelectionIndent = 0;
CheckBox checkBox = new CheckBox();
checkBox.Height = 20;
checkBox.Width = 20;
richTextBoxPCRBaseline.Controls.Add(checkBox);
checkBox.Tag = i_objPCRCheck;
richTextBoxPCRBaseline.SelectionIndent = 30;
richTextBoxPCRBaseline.SelectedText = "Section : '" + i_objPCRCheck.taskname;
richTextBoxPCRBaseline.SelectedText = "\n\n";
}
}
我得到了这个错误
CS1503参数1:无法从“对象”转换为“ MyApplication.GetBaselineSectionTasks”
它来自以下行:private void buttonConfirm_Click(object sender, EventArgs e, out List<GetBaselineSectionTasks> m_objCheckeditem)
{
int i = 0;
m_objCheckeditem = new List<GetBaselineSectionTasks>();
foreach (CheckBox i_objCheck in richTextBoxPCRBaseline.Controls)
{
if (i_objCheck.Checked)
{
m_objCheckeditem.Add(i_objCheck.Tag);
MessageBox.Show(i_objCheck.Tag.ToString());
}
i++;
}
}
这是我第一次使用.Tag属性,因此我建议它不能那样工作。
关于如何获取已检查的物品并将其退回的任何想法吗?