Monday 27 August 2012

Try And Catch asp.net | How to write code

 Try And Catch asp.net | How to write code

Asp.net program code for Sale system with output
using System;


using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void orderbtn_Click(object sender, EventArgs e)
{
int p = 0, q = 0, d = 0;
float amt = 0;
String n = "";
try
{
n = this.txtname.Text;
p = int.Parse(txtprice.Text);
q = int.Parse(txtquantity.Text);
d = int.Parse(txtdiscount.Text);
amt = p * q*(1 - d / 100f);
lblnm.Visible = true;
lblnm.Text = "you have purchased " + q + "units of " + n + "at the price of " + d + "and you have to pay Rs" + amt;
}
catch (Exception ex)
{
lblnm.Visible = true;
lblnm.Text = "error occurs please renter the data";
}
}
protected void clearbtn_Click(object sender, EventArgs e)
{
txtname.Text = "";
txtprice.Text = "";
txtquantity.Text = "";
txtdiscount.Text = "";
lblnm.Visible = false;
}
}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: