Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            SelectedAgent select_agent = new SelectedAgent();

            select_agent.Show();
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlCommand GetAgents = SqlConnectionCommand.getCommand();

            GetAgents.CommandText = "USE srdb SELECT * FROM AGENT ";
            SqlDataReader reader = GetAgents.ExecuteReader();

            DataTable dataTable = new DataTable();

            dataTable.Load(reader);

            Agentgrid.DataSource = dataTable;



            Agentgrid.ReadOnly = true;
            String type = Agentgrid.Rows[e.RowIndex].Cells[0].Value.ToString();

            this.Hide();

            SelectedAgent Agent_page = new SelectedAgent();

            Agent_page.AgentIDBox.Text   = Agentgrid.Rows[e.RowIndex].Cells[0].Value.ToString();
            Agent_page.Firstnamebox.Text = Agentgrid.Rows[e.RowIndex].Cells[1].Value.ToString();
            Agent_page.Lastnamrbox.Text  = Agentgrid.Rows[e.RowIndex].Cells[2].Value.ToString();
            Agent_page.AddressBox.Text   = Agentgrid.Rows[e.RowIndex].Cells[3].Value.ToString();
            Agent_page.CityBox.Text      = Agentgrid.Rows[e.RowIndex].Cells[4].Value.ToString();
            Agent_page.statetextbox.Text = Agentgrid.Rows[e.RowIndex].Cells[5].Value.ToString();
            Agent_page.Zipcodebox.Text   = Agentgrid.Rows[e.RowIndex].Cells[6].Value.ToString();
            Agent_page.PhoneBox.Text     = Agentgrid.Rows[e.RowIndex].Cells[7].Value.ToString();
            Agent_page.EmailBox.Text     = Agentgrid.Rows[e.RowIndex].Cells[8].Value.ToString();
            Agent_page.StartDateBOx.Text = Agentgrid.Rows[e.RowIndex].Cells[9].Value.ToString();
            Agent_page.DOBBox.Text       = Agentgrid.Rows[e.RowIndex].Cells[10].Value.ToString();
            Agent_page.StatusBox.Text    = Agentgrid.Rows[e.RowIndex].Cells[11].Value.ToString();



            /*Property_page.Fname.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[2].Value.ToString();
             *       Property_page.Mname.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[3].Value.ToString();
             *       Property_page.Lname.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[4].Value.ToString();
             *       Property_page.Email.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[5].Value.ToString();
             *       Property_page.Phone.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[6].Value.ToString();
             *       Property_page.StrAdd.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[7].Value.ToString();
             *       Property_page.City.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[8].Value.ToString();
             *       Property_page.State.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[9].Value.ToString();
             *       Property_page.Zip.Text = dataGridViewBuyerSeller.Rows[e.RowIndex].Cells[10].Value.ToString();*/

            Agent_page.Show();
        }