コード例 #1
0
        private void cmdRegister_Click(object sender, EventArgs e)
        {
            Myusers u1 = new Myusers();

            u1.Username = textBox1.Text;
            u1.Answer   = textBox2.Text;
            u1.Password = textpwd.Text;
            u1.Question = comboBox1.Text;

            Dataclass.users.Add(u1);
            MessageBox.Show("user register");
            textBox1.Text = "";
            textpwd.Text  = "";
        }
コード例 #2
0
        private void cmd_add_Click(object sender, EventArgs e)
        {
            mycontacts c = new mycontacts();

            c.Name = textBox1.Text;
            c.Cell = textBox2.Text;
            Myusers cu = MyUtill.loginuser;

            MyUtill.loginuser.Contacts.Add(c);
            BindingSource source = new BindingSource();

            source.DataSource        = MyUtill.loginuser.Contacts;
            dataGridView1.DataSource = source;
        }