Programming Tips for .NET Guys !


1. How to handle single quote (‘) during insertion and updation ?

Suppose there is a text box in form and you want to handle single quote ( ‘ ) during insertion and updation.

string StrValue=this.TextBox1.Text;
StrValue=StrValue.Replace(“‘”,”””);

2. How to handle maximum length in multi line text box ?

Suppose there is a multi line text box in form and you want to handle maximum length during insertion and updation.

int MaxLength=this.TextBox1.Text.Length;
if(MaxLength>=100)
MaxLength=100;
string StrMaxLength=this.TextBox1.Text.SubString(0,MaxLength);

3. How to do date time search in string mode ?

Suppose there is a text box in form and you want to search a date in grid using text entered in text box.

DateTime ScheduledDate=Convert.ToDateTime(this.TextBox1.Text);
string StrScheduledDate= ScheduledDate.ToString(MM,dd,yyyy);

Advertisements

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s