I have form with button and checkbox. if i hit button static void is called which call non static void which shows messagebox with the checkbox.checked.toString() The problem is if i change the checkbox value it always shows false
Code is
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } public void y() { MessageBox.Show(checkBox1.Checked.ToString()); } static void x() { Form1 f = new Form1(); f.y(); } private void button1_Click(object sender, EventArgs e) { x(); } } }
Try