Inheritance: WindowsFormsApp1.Form
Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int x, y, z;

            try
            {
                x = Int32.Parse(comboBox1.Text);
                y = Int32.Parse(comboBox2.Text);
                z = Int32.Parse(comboBox3.Text);
                if (x >= 3 && x <= 5 && y >= 7 && y <= 14 && z >= 2001 && z <= 2050)
                {
                }
                else
                {
                    MessageBox.Show("Please enter every values given in menu");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please enter every values given in menu");
                return;
            }
            WindowsFormsApp1.Form1 ss = new WindowsFormsApp1.Form1(x, y, z);
            Form2 ss2 = new Form2(x, y, z);

            ss.Show();
            this.Hide();
        }
Example #2
0
 public Form2(OracleConnection coon, Form1 Owner)
 {
     InitializeComponent();
     cnn   = coon;
     owner = Owner;
 }
Example #3
0
 public Form2(Form1 mf1)
 {
     InitializeComponent();
     mf = mf1;
 }
Example #4
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Form1 form = new Form1();

            form.Show();
        }
Example #5
0
 private void btn_help_Click(object sender, EventArgs e)
 {
     WindowsFormsApp1.Form1 Form2 = new WindowsFormsApp1.Form1();
     Form2.Show();                                                  // opens the help menu window
 }
Example #6
0
        public void FinishConnection()
        {
            /*
             * Move the attached endpoint of the line stored in default_endpoint to the most appropriate anchor point.
             *
             * For a box with 4 sides, there can be at most 2 possible faces (anchor points) the line can be attached at.
             *
             * This could be made more efficient by ackowledging that if, for example, if farEndPoint.Y is between
             * TLCorner.Y and TLCorner.Y + height (i.e. the top and bottom of the box), then both the top and bottom anchors can be eliminated, leaving only left and right.
             * I decided not to implement it that way because it would take longer, would be less readable, would be easier to skrew up, and because the added if statements
             * may harm the program's performance in most cases (if not implemented well).
             */

            Point farEndPoint = default_anchor.GetEndPoint(this, false);

            if (farEndPoint.Y <= TLCorner.Y)             //eliminate the bottom anchor
            {
                float distanceT = Form1.distance(farEndPoint, get_top_anchor_position());

                if (farEndPoint.X <= TLCorner.X)                 //eliminate the right anchor
                {
                    float distanceL = Form1.distance(farEndPoint, get_left_anchor_position());

                    if (distanceT <= distanceL)
                    {
                        default_anchor.MoveEndpoint(this, get_top_anchor_position());
                        top_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                    else
                    {
                        default_anchor.MoveEndpoint(this, get_left_anchor_position());
                        left_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                }
                else                 //eliminate the left anchor
                {
                    float distanceR = Form1.distance(farEndPoint, get_right_anchor_position());

                    if (distanceT <= distanceR)
                    {
                        default_anchor.MoveEndpoint(this, get_top_anchor_position());
                        top_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                    else
                    {
                        default_anchor.MoveEndpoint(this, get_right_anchor_position());
                        right_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                }
            }
            else             //eliminate the top anchor
            {
                float distanceB = Form1.distance(farEndPoint, get_bottom_anchor_position());

                if (farEndPoint.X <= TLCorner.X)                 //eliminate the right anchor
                {
                    float distanceL = Form1.distance(farEndPoint, get_left_anchor_position());

                    if (distanceB <= distanceL)
                    {
                        default_anchor.MoveEndpoint(this, get_bottom_anchor_position());
                        bottom_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                    else
                    {
                        default_anchor.MoveEndpoint(this, get_left_anchor_position());
                        left_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                }
                else                 //eliminate the left anchor
                {
                    float distanceR = Form1.distance(farEndPoint, get_right_anchor_position());

                    if (distanceB <= distanceR)
                    {
                        default_anchor.MoveEndpoint(this, get_bottom_anchor_position());
                        bottom_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                    else
                    {
                        default_anchor.MoveEndpoint(this, get_right_anchor_position());
                        right_anchor.Add(default_anchor);
                        default_anchor = null;
                    }
                }
            }


            /*
             *
             * float distanceT = Form1.distance(farEndPoint, get_top_anchor_position());
             * float distanceB = Form1.distance(farEndPoint, get_bottom_anchor_position());
             * float distanceL = Form1.distance(farEndPoint, get_left_anchor_position());
             * float distanceR = Form1.distance(farEndPoint, get_right_anchor_position());
             *
             * if(distanceT <= distanceB)	//top or bottom?
             * {
             *      if(distanceL <= distanceR) //left or right?
             *      {
             *              if(distanceT <= distanceL) //Top anchor has the shortest distance
             *              {
             *                      default_anchor.MoveEndpoint(this, get_top_anchor_position());
             *                      top_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *
             *              else //left anchor
             *              {
             *                      default_anchor.MoveEndpoint(this, get_left_anchor_position());
             *                      left_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *      }
             *
             *      else	//top or right?
             *      {
             *              if (distanceT <= distanceL) //Top anchor has the shortest distance
             *              {
             *                      default_anchor.MoveEndpoint(this, get_top_anchor_position());
             *                      top_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *
             *              else //right anchor
             *              {
             *                      default_anchor.MoveEndpoint(this, get_right_anchor_position());
             *                      right_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *      }
             * }
             * else
             * {
             *      if (distanceL <= distanceR) //left or right?
             *      {
             *              if (distanceB <= distanceL) //bottom anchor has the shortest distance
             *              {
             *                      default_anchor.MoveEndpoint(this, get_bottom_anchor_position());
             *                      bottom_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *
             *              else //left anchor
             *              {
             *                      default_anchor.MoveEndpoint(this, get_left_anchor_position());
             *                      left_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *      }
             *
             *      else    //bottom or right?
             *      {
             *              if (distanceB <= distanceL) //bottom anchor has the shortest distance
             *              {
             *                      default_anchor.MoveEndpoint(this, get_bottom_anchor_position());
             *                      bottom_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *
             *              else //right anchor
             *              {
             *                      default_anchor.MoveEndpoint(this, get_right_anchor_position());
             *                      right_anchor.Add(default_anchor);
             *                      default_anchor = null;
             *              }
             *      }
             * }
             *
             */
        }
Example #7
0
        public async void Dobavit1(object sender, EventArgs e, SqlConnection sqlConnection, Form1 form)
        {
            string        connectionSTR = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\User\source\repos\WindowsFormsApp2\Database1.mdf;Integrated Security=True";
            SqlConnection SqlConnection = new SqlConnection(connectionSTR);
            await SqlConnection.OpenAsync();

            if (!string.IsNullOrEmpty(form.textBox2.Text) && !string.IsNullOrWhiteSpace(form.textBox2.Text))
            {
                string     x          = form.comboBox1.Text;
                SqlCommand sqlCommand = new SqlCommand("INSERT INTO [" + x + "] (VZ,FIO) VALUES (@VZ,@FIO)", SqlConnection);
                if (x == "Офицеры" && form.comboBox4.Text != "")
                {
                    sqlCommand.Parameters.AddWithValue("VZ", form.comboBox4.Text);
                }
                if (x == "Прапорщики" && form.comboBox5.Text != "")
                {
                    sqlCommand.Parameters.AddWithValue("VZ", form.comboBox5.Text);
                }
                if (x != "Офицеры" && x != "Прапорщики" && form.comboBox3.Text != "")
                {
                    sqlCommand.Parameters.AddWithValue("VZ", form.comboBox3.Text);
                }

                sqlCommand.Parameters.AddWithValue("FIO", form.textBox2.Text);
                await sqlCommand.ExecuteNonQueryAsync();

                form.обновитьToolStripMenuItem_Click(sender, e);
                MessageBox.Show("Информация успешно добавлена");
                form.comboBox3.Text = "";
                form.comboBox4.Text = "";
                form.comboBox5.Text = "";
                form.textBox2.Clear();
            }



            else
            {
                MessageBox.Show("Ошибка.Поля для ввода должны быть заполнены");
            }
        }
Example #8
0
 public Form2(Form1 form)
 {
     form1 = form;
     InitializeComponent();
     orderBindingSource.DataSource = orderService.orders;
 }
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            Form1 f1 = new Form1();

            f1.Show();
        }
Example #10
0
        public CreateData(Form1 parentWindow)
        {
            InitializeComponent();

            parent = parentWindow;

            sqlDataManager = new List <SQLData>
            {
                new SQLData {
                    name = "EmployeeID", param = "@EmployeeID", c = TB_EmployeeID, sqlType = SqlDbType.Int, type = typeof(int)
                },
                new SQLData {
                    name = "LastName", param = "@LastName", c = TB_LastName, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "FirstName", param = "@FirstName", c = TB_FirstName, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "Title", param = "@Title", c = TB_Title, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "TitleOfCourtesy", param = "@TitleOfCourtesy", c = TB_TitleOfCourtesy, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "BirthDate", param = "@BirthDate", c = TB_BirthDate, sqlType = SqlDbType.DateTime, type = typeof(string)
                },
                new SQLData {
                    name = "HireDate", param = "@HireDate", c = TB_HireDate, sqlType = SqlDbType.DateTime, type = typeof(string)
                },
                new SQLData {
                    name = "Address", param = "@Address", c = TB_Address, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "City", param = "@City", c = TB_City, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "Region", param = "@Region", c = TB_Region, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "PostalCode", param = "@PostalCode", c = TB_PostalCode, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "Country", param = "@Country", c = TB_Country, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "HomePhone", param = "@HomePhone", c = TB_HomePhone, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "Extension", param = "@Extension", c = TB_Extension, sqlType = SqlDbType.NVarChar, type = typeof(string)
                },
                new SQLData {
                    name = "Photo", param = "@Photo", c = null, sqlType = SqlDbType.Image, type = typeof(byte[])
                },
                new SQLData {
                    name = "Notes", param = "@Notes", c = TB_Notes, sqlType = SqlDbType.NText, type = typeof(string)
                },
                new SQLData {
                    name = "ReportsTo", param = "@ReportsTo", c = TB_ReportsTo, sqlType = SqlDbType.Int, type = typeof(int)
                },
                new SQLData {
                    name = "PhotoPath", param = "@PhotoPath", c = TB_PhotoPath, sqlType = SqlDbType.NVarChar, type = typeof(string)
                }
            };
        }
 public Form2(Form callingForm)
 {
     mainForm = callingForm as Form1;
     InitializeComponent();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            SqlDataAdapter da = new SqlDataAdapter("select CUSERNAME from Customer where CUSERNAME ='******'", cm);
            DataTable      dt = new DataTable();

            da.Fill(dt);

            SqlDataAdapter da1 = new SqlDataAdapter("select  Username from Vendor where Username ='******'", cm);
            DataTable      dt1 = new DataTable();

            da1.Fill(dt1);

            if (dt.Rows.Count == 0 && dt1.Rows.Count == 0)
            {
                if (textBox1.Text == "")
                {
                    MessageBox.Show("Enter First_Name");
                }
                else if (textBox2.Text == "")
                {
                    MessageBox.Show("Enter LastName");
                }
                else if (textBox3.Text == "")
                {
                    MessageBox.Show("Enter City");
                }
                else if (textBox4.Text == "")
                {
                    MessageBox.Show("Enter State");
                }
                else if (textBox5.Text == "")
                {
                    MessageBox.Show("Enter Pincode");
                }
                else if (textBox6.Text == "")
                {
                    MessageBox.Show("Enter contact no");
                }
                else if (textBox7.Text == "")
                {
                    MessageBox.Show("Enter EmailID");
                }
                else if (textBox8.Text == "")
                {
                    MessageBox.Show("Enter username");
                }
                else if (textBox9.Text == "")
                {
                    MessageBox.Show("Enter Password");
                }
                else
                {
                    addcustomerdetails();
                    //MessageBox.Show("Signed up successfully.Please Login after 5 minutes");
                    //Application.Exit();
                    //Form4 obj9 = new Form4();
                    // obj9.Show();
                    MessageBox.Show("Now login..");
                    Form1 obj = new Form1();
                    obj.Show();
                    this.Hide();
                }
            }

            else
            {
                MessageBox.Show("Username already in use...");
            }
        }
Example #13
0
 public Form2(Form1 form1)
 {
     InitializeComponent();
     this.form1 = form1;
 }
Example #14
0
 private void button1_Click(object sender, EventArgs e)
 {
     Form1 form = new Form1();
     form.Show();
     this.Hide();
 }
Example #15
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form1 form1 = new Form1();

            form1.Show();
        }
Example #16
0
        private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 newForm = new Form1();

            newForm.Show();
        }
Example #17
0
 public Edit(Form1 owner)
 {
     InitializeComponent();
     form1             = owner;
     this.FormClosing += new FormClosingEventHandler(this.Form2_FormClosing);
 }
 private void çıkışToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form1 form1 = new Form1();
     form1.Show();
     this.Hide();
 }
Example #19
0
		private void button2_Click(object sender, EventArgs e)
		{
			Hide();
			Form1 form1 = new Form1();
			form1.ShowDialog();
		}