Esempio n. 1
0
 protected void LB_DoubleClick(object sender, EventArgs e)
 {
     //attempt to cast the sender as a label
     Label lbl = sender as Label;
     if (listBox3.Items.Contains(lbl.Name))
     {
         Form8 frm = new Form8(lbl.Name);
         frm.Show();
     }
 }
Esempio n. 2
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                string city = dataGridView1.CurrentCell.Value.ToString();

                MySqlConnection connection = new MySqlConnection(sqlcon);
                connection.Open();
                MySqlCommand command = connection.CreateCommand();
                MySqlDataReader reader;

                command.CommandText = "SELECT * FROM regions where name=@p1";
                command.Prepare();
                command.Parameters.AddWithValue("@p1", city);
                reader = command.ExecuteReader();
                reader.Read();

                string owner = Convert.ToString(reader["owner"]);
                reader.Close();

                if(owner == textBox1.Text)
                {
                    Form8 frm = new Form8(city);
                    frm.Show();
                }
            }
        }
Esempio n. 3
0
        private void listBox3_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string text = listBox3.GetItemText(listBox3.SelectedItem);

            Form8 frm = new Form8(text);
            frm.Show();
        }