private void btnsave_Click(object sender, EventArgs e) { if (txtid.Text == "ID" || txtcode.Text == "code" || txtname.Text == "Product Name" || txtstock.Text == "stock" || txtcategory.Text == "Category" || txtexpired.Text == "expired" || cmbState.Text == "State" || txtdescription.Text == "Description") { MessageBox.Show("Fill empty fields"); } else { string id, code, name, stock, category, expired, state, description; id = txtid.Text; code = txtcode.Text; name = txtname.Text; stock = txtstock.Text; category = txtcategory.Text; expired = txtexpired.Text; state = cmbState.Text; description = txtdescription.Text; gvproducts.DataSource = productoP.Mostrar(id, code, name, stock, expired, category, state, description); //Aqui se toman las variables de la clase SharedVar y se les agregan los valores de los texbox para llevarlos a la capa principal SharedVar.id = txtid.Text; SharedVar.code = txtcode.Text; SharedVar.name = txtname.Text; SharedVar.stock = txtstock.Text; SharedVar.expired = txtexpired.Text; SharedVar.category = txtcategory.Text; SharedVar.state = cmbState.Text; SharedVar.description = txtdescription.Text; } }
private void update_Tick(object sender, EventArgs e) { if (SharedVar.id != "") { gvmain.DataSource = productoP.Mostrar(SharedVar.id, SharedVar.code, SharedVar.name, SharedVar.stock, SharedVar.expired, SharedVar.category, SharedVar.state, SharedVar.description); SharedVar.id = ""; } }