Пример #1
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            int?id = GetId();
            int valorcillo;

            //     MessageBox.Show(id.ToString());
            if (id != null)
            {
                DataSet1TableAdapters.MedicineTableAdapter ta = new DataSet1TableAdapters.MedicineTableAdapter();
                DataSet1.MedicineDataTable pt = ta.GetDataByIdMedicine((int)id);

                DataSet1.MedicineRow row = (DataSet1.MedicineRow)pt.Rows[0];

                txtNombre.Text = row.MedicineName;


                udCantidad.Value = row.MedicineQuantity;
                txtPres.Text     = row.MedicineQuantityPres;
                udUnidades.Value = row.MedicineUnits;
                //  txtTipoUnidad.Text = row.MaterialUnitType;
                clnFechaExp.SetDate(row.MedicineExpDate);
                txtTipoUnidad.Text    = row.MedicineUnitsType;
                udUnidadesDosis.Value = row.MedicineDosUnits;
                udCantidadDosis.Value = row.MedicineDosQuan;

                valorcillo = row.idSupplier;
                // MessageBox.Show(valorcillo.ToString());
                //from here
                DataSet1TableAdapters.SupplierTableAdapter tas = new DataSet1TableAdapters.SupplierTableAdapter();
                DataSet1.SupplierDataTable pts = tas.GetDataByIdSupplier((int)valorcillo);
                //  DataSet1.SupplierRow rowsup = (DataSet1.SupplierRow)pts.Rows[0];
                //  txtProveedor.Text = rowsup.ToString();

                dgvProveedor.DataSource = pts;
            }
            else
            {
                MessageBox.Show("No hay registros");
            }
        }