Example #1
0
 public Form1()
 {
     InitializeComponent();
     otherForm = new OtherForm();
     otherForm.Show(this);
     textBox1.TextChanged += textBox1_TextChanged;
 }
Example #2
0
    // assuming here you have three textboxes
    private void button1_Click(eventargs etc)
    {
        OtherForm otherForm = new OtherForm()
        {
            Text1 = textbox1.Text,
            Text2 = textbox2.Text,
            Text3 = textbox3.Text
        };

        otherForm.Show();
    }
Example #3
0
        public void Check(string _txtB_login, string _txtB_password)
        {
            try
            {
                if (connection != null)
                {
                    connection.Close();
                }
                connection.Open();
                string com = "SELECT * FROM [registration] WHERE [login]=@login AND [password]=@password";

                OleDbCommand _command = new OleDbCommand(com, connection);
                _command.Parameters.AddWithValue("@login", _txtB_login);
                _command.Parameters.AddWithValue("@password", _txtB_password);
                OleDbDataReader reader = _command.ExecuteReader();

                int count = 0;

                while (reader.Read())
                {
                    count++;
                }

                if (count == 1)
                {
                    if (MessageBox.Show("Добро пожаловать!", "Welcome!!!", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        OtherForm _form = new OtherForm();
                        _form.Show();
                        this.Hide();
                    }
                }
                else if (count > 1)
                {
                    MessageBox.Show("???-???-???-???-???-???!", "Welcome!!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Извините не правильно введены данные!\n" + "Для просмотра предложений о недвижимости зайдите через гостевой режим.", "Welcome!!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox1.Text = null;
                    textBox2.Text = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Welcome Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                connection.Close();
            }
        }
Example #4
0
 public Form1()
 {
     InitializeComponent();
     otherForm = new OtherForm();
     otherForm.Show(this);
 }