private void Modificacion_medida_Load(object sender, EventArgs e)
        {
            Base_de_datos busc = new Base_de_datos();

            busc.BuscarMedida();
            dataGridView1.DataSource = busc.Mostrar_Resultados();
        }
        private void btnModificar_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtCodigoRol.Text) == false)
            {
                MessageBox.Show("Llene todos los campos obligatorios");
                return;
            }

            if (!string.IsNullOrEmpty(txtNombreRol.Text) == false)
            {
                MessageBox.Show("Llene el nombre de medida");
                return;
            }

            int ver = Base_de_datos.validarNomMedidaMod(txtNombreRol.Text, txtCodigoRol.Text);

            if (ver != 1)
            {
                MessageBox.Show("Medida ya existente");
                return;
            }

            string estado;

            if (cmbestado.Text == "Activo")
            {
                estado = "ACT";
            }

            else
            {
                estado = "INC";
            }

            Base_de_datos.Actualizar_Medida(int.Parse(txtCodigoRol.Text), txtNombreRol.Text.ToUpper(), estado);

            MessageBox.Show("Medida modificada.");

            Base_de_datos busc = new Base_de_datos();

            busc.BuscarMedida();
            dataGridView1.DataSource = busc.Mostrar_Resultados();

            txtCodigoRol.Clear();
            txtNombreRol.Clear();

            btnModificar.Enabled = false;
            this.Hide();
        }
        public Ingresar_medicamento()
        {
            InitializeComponent();
            dataGridView1.AllowUserToAddRows = false;
            timer1.Enabled = true;
            Base_de_datos busc = new Base_de_datos();

            busc.BuscarMedida();
            dataGridView1.DataSource = busc.Mostrar_Resultados();
            dateTimePicker1.MinDate  = DateTime.Now;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                txtUnidad.Items.Add(row.Cells[1].Value.ToString());
            }
        }
        public Modifcar_medicamento()
        {
            InitializeComponent();
            codigomed.Text    = Base_de_datos.CodMed;
            txtnom.Text       = Base_de_datos.nommedi;
            txtprecio.Text    = Base_de_datos.Precio_medicamento(Base_de_datos.CodMed);
            richTextBox1.Text = Base_de_datos.desc;
            dataGridView1.AllowUserToAddRows = false;
            Base_de_datos busc = new Base_de_datos();

            busc.BuscarMedida();
            dataGridView1.DataSource = busc.Mostrar_Resultados();
            txtcant.Text             = Base_de_datos.vcant;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                txtUnidad.Items.Add(row.Cells[1].Value.ToString());
            }
            txtUnidad.Text = Base_de_datos.unidad;
        }