private void txt1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { //do something } }
Monday, 14 May 2012
KEYPRESS EVENT IN C#
Thursday, 10 May 2012
CALCULATION IN TEXTBOX USING Convert.ToInt32 and int.parse
USING Convert.ToInt32
private void button1_Click(object sender, EventArgs e) { int value1 = Convert.ToInt32(this.textBox1.Text); int value2 = Convert.ToInt32(this.textBox2.Text); int value3 = Convert.ToInt32(this.textBox3.Text); int value4 = (value2-value1) * value3; this.textBox4.Text = value4.ToString(); }USING int.Parse
private void button1_Click(object sender, EventArgs e) { int value1 =(textBox1.Text); int value2 = int.Parse(textBox2.Text); int value3 = int.Parse(label1.Text); intvalue4 = (value2-value1) * value3; textBox4.Text = value4.ToString(); }
Sunday, 6 May 2012
COOKIES IN ASP.NET
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "Ajith";
TextBox2.Text = "bmw";
HttpCookie usercars = Request.HttpCookie["favouritecar"];
if(usecookie == null)
{
HttpCookie usecar = new HttpCookie("favouritecar");
usecar["name"] = TextBox1.Text.ToString();
usecar["car"] = TextBox2.Text.ToString();
usecar.Expires.DateTime.Now.AddDays(1);
Response.Cookie.Add(usecar);
}
else
{
String name =usercars["name"];
String car = usercars["car"];
Label1.Text = "hi" + name + "is using" +car ;
}
}
}
{
TextBox1.Text = "Ajith";
TextBox2.Text = "bmw";
HttpCookie usercars = Request.HttpCookie["favouritecar"];
if(usecookie == null)
{
HttpCookie usecar = new HttpCookie("favouritecar");
usecar["name"] = TextBox1.Text.ToString();
usecar["car"] = TextBox2.Text.ToString();
usecar.Expires.DateTime.Now.AddDays(1);
Response.Cookie.Add(usecar);
}
else
{
String name =usercars["name"];
String car = usercars["car"];
Label1.Text = "hi" + name + "is using" +car ;
}
}
}
COUNTING CLICK USING VIEWSTATE
protected void Button1_Click(object sender, EventArgs e)
{
int click = 1;
if(ViewState["clickcount"] == nul)
{
click = 1;
}
else
{
click = (int)ViewState["clickcount"] + 1;
}
ViewState["clickcount] = click;
Label1.Text = "Buttonclick" + click + "times";
}
{
int click = 1;
if(ViewState["clickcount"] == nul)
{
click = 1;
}
else
{
click = (int)ViewState["clickcount"] + 1;
}
ViewState["clickcount] = click;
Label1.Text = "Buttonclick" + click + "times";
}
Friday, 4 May 2012
BASIC MOTION USING FLASH
Open flash --> open file and select new flash document --> Select or open a picture
-->Right click at the starting of the time frame --> select Insert keyframe
--> Similarly right click at any second of the time frame as ending and select Insert
keyframe --> Move the picture --> Now right click at the starting of the time frame and
Create Motion Tween--> Finally press Ctrl Enter...
The picture will move from one place to another as we moved..
Subscribe to:
Posts (Atom)