private void btnorder_Click(object sender, EventArgs e) { if (txttblno.Text.Length > 0) { int i = blord.insertorder(txtusername.Text, Convert.ToInt32(txttblno.Text), cboitem.Text.ToString(), Convert.ToInt32(txtquantity.Text), Convert.ToInt32(txttotal.Text), Convert.ToInt32(txtcost.Text)); gridview(); } }
private void btnorder_Click(object sender, EventArgs e) { int parsedvalue; if (txtusername.Text == "" || txttblno.Text == "" || txtquantity.Text == "") { MessageBox.Show("inputs are required"); } else if (!int.TryParse(this.txttblno.Text, out parsedvalue) || !int.TryParse(this.txtquantity.Text, out parsedvalue) || !int.TryParse(this.txtcost.Text, out parsedvalue) || !int.TryParse(this.txttotal.Text, out parsedvalue)) { lblmsg.Text = ("the input are invalid...");//assigning the text in labels } else { if (txttblno.Text.Length > 0) { int i = blord.insertorder(txtusername.Text, Convert.ToInt32(txttblno.Text), cboitem.Text.ToString(), Convert.ToInt32(txtquantity.Text), Convert.ToInt32(txttotal.Text), Convert.ToInt32(txtcost.Text)); gridview(); print(); } } }