Exemple #1
0
        private void dgvMedicalShop_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
                {
                    if (dgvMedicalShop.SelectedRows.Count > 0)
                    {
                        txtMedicalName.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[0].Value);
                        string ShopName = txtMedicalName.Text;
                        BLMedicalShop objMedicalShop = new BLMedicalShop();
                        DataTable dt = objMedicalShop.GetID(ShopName);
                        if (dt.Rows.Count != 0)
                        {
                            lblMedicalShopid.Text = dt.Rows[0]["MedicalShopID"].ToString();
                        }
                       // lblMedicalShopid.Text = dgvMedicalShop.SelectedRows[0].Cells["MedicalShopID"].Value.ToString();
                        txtMedicalName.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[0].Value);
                        cbCountry.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[1].Value);
                        cbState.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[2].Value);
                        cbCity.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[3].Value);
                        txtArea.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[4].Value);
                        txtAddress.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[5].Value);
                        txtOwnerName.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[6].Value);
                        txtSellerContactNo.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[7].Value);
                        cbShopType.Text = Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[8].Value);
                        //dgvMedicalShop.Columns["MedicalShopID"].Visible = false;
                        string Active= Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[9].Value);
                        txtOpningBalance.Text=Convert.ToString(dgvMedicalShop.SelectedRows[0].Cells[11].Value);
                        txtOpningBalance.ReadOnly = true;
                        if (Active == "Yes")
                        {
                            cbActive.Checked = true;
                        }
                        else
                        {
                            cbActive.Checked = false;
                        }
                        btnsave.Text = "Update";

                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
        }