listGrid.MouseClick += new MouseEventHandler(clsMouseEvent.radiobutton1_MouseClick); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 但是提示错误:非静态的字段、方法或属性
请问:我错在哪呢?请指教,谢谢
------解决方案-------------------- public static void radiobutton1_MouseClick(object sender, MouseEventArgs e) { 鼠标操作datagridview } 加上 static 修饰
------解决方案-------------------- public static void radiobutton1_MouseClick(object sender, MouseEventArgs e) 或者 clsMouseEvent mouse = new clsMouseEvent(); listGrid.MouseClick += new MouseEventHandler(mouse .radiobutton1_MouseClick);
------解决方案-------------------- 借用下楼上的代码 public static void radiobutton1_MouseClick(object sender, MouseEventArgs e) 或者 clsMouseEvent mouse = new clsMouseEvent(Form1);
public class Form1{ public Form1(Form1 form1){ form1.MouseClick += new MouseEventHandler(form1 .radiobutton1_MouseClick); .... event1 event2(同样 方法处理) }