public Form1() { InitializeComponent(); string Sql = "SELECT [Lot ID] from LotID"; SqlConnection conn = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;Initial Catalog=Car Dealership;Integrated Security=True"); conn.Open(); SqlCommand cmd = new SqlCommand(Sql, conn); SqlDataReader DR = cmd.ExecuteReader(); while (DR.Read()) { dealerTxtBox.Items.Add(DR[0]); LotFilterTB.Items.Add(DR[0]); } this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick); //Getting list of models for combobox Sql = "SELECT [Make] from MakeModelID"; conn = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;Initial Catalog=Car Dealership;Integrated Security=True"); conn.Open(); cmd = new SqlCommand(Sql, conn); DR = cmd.ExecuteReader(); while (DR.Read()) { if (!makeTxtBox.Items.Contains(DR[0])) { makeTxtBox.Items.Add(DR[0]); } } //Getting list of Colors for combobox Sql = "SELECT [Color] from ColorID"; conn = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;Initial Catalog=Car Dealership;Integrated Security=True"); conn.Open(); cmd = new SqlCommand(Sql, conn); DR = cmd.ExecuteReader(); while (DR.Read()) { ColorComboBox.Items.Add(DR[0]); } //Hiding Stuff FilterLabel.Hide(); LotFilterTB.Hide(); }
private void button1_Click(object sender, EventArgs e) { con = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;Initial Catalog=Car Dealership;Integrated Security=True"); con.Open(); SqlDataAdapter sqlDa = new SqlDataAdapter("Select * FROM LotCarID", con); DataTable dtbl = new DataTable(); sqlDa.Fill(dtbl); dataGridView1.DataSource = dtbl; FilterLabel.Show(); LotFilterTB.Show(); con.Close(); }
void ReleaseDesignerOutlets() { if (CurrentFilterLabel != null) { CurrentFilterLabel.Dispose(); CurrentFilterLabel = null; } if (FilterLabel != null) { FilterLabel.Dispose(); FilterLabel = null; } if (FilterSearchBar != null) { FilterSearchBar.Dispose(); FilterSearchBar = null; } if (FilterSegmentControl != null) { FilterSegmentControl.Dispose(); FilterSegmentControl = null; } if (FilterStackView != null) { FilterStackView.Dispose(); FilterStackView = null; } if (LeadsOnlyButton != null) { LeadsOnlyButton.Dispose(); LeadsOnlyButton = null; } if (MasterTableView != null) { MasterTableView.Dispose(); MasterTableView = null; } }