} //Salir de este form private void button1_Click(object sender, EventArgs e) //Filtrar por compañías { DataTable dt = db.getByCompania(textBox1.Text); dataGridView1.DataSource = dt; dataGridView1.Refresh(); }
private void evento(object sender, EventArgs e) //Listar los datos de un avion al hacer click sobre él { PictureBox p = (PictureBox)sender; int tag = (int)p.Tag; string id = lista.GetAvion(tag).GetIdentificador(); string co = lista.GetAvion(tag).GetCompañia(); int posx = lista.GetAvion(tag).GetPosicionX(); int posy = lista.GetAvion(tag).GetPosicionY(); float destx = lista.GetAvion(tag).GetDestinoX(); float desty = lista.GetAvion(tag).GetDestinoY(); float vel = lista.GetAvion(tag).GetVelocidad(); string dbLocation = "..\\..\\..\\PROYECTO_0\\MiDatabase.sdf"; DBGestion db; db = new DBGestion(dbLocation); int res = db.openDB(); if (res == -1) { MessageBox.Show("Error abriendo la base de datos"); } DataTable dt = db.getByCompania(co); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; MessageBox.Show("Este es el avión: " + id + "." + "\nCon coordenadas: " + "(" + posx + "," + posy + ")." + "\nCon destino: " + "(" + destx + "," + desty + ")." + "\nCon velocidad: " + vel + " nudos." + "\nCon compañía: " + co + "." + "\nEmail: " + row[2] + "."); } else { MessageBox.Show("Este es el avión: " + id + "." + "\nCon coordenadas: " + "(" + posx + "," + posy + ")." + "\nCon destino: " + "(" + destx + "," + desty + ")." + "\nCon velocidad: " + vel + " nudos." + "\nCon compañía: " + co + "." + "\nEmail: No disponible."); } db.closeDB(); }