C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Visual Studio »

Counting enterd text using C#


Posted Date: 17 Aug 2009    Resource Type: Code Snippets    Category: Visual Studio
Author: Syed Shakeer Hussain Member Level: Diamond    
Rating: 1 out of 5Points: 7



Description :


Drag and drop two textboxs on windows form.one for entering text and another textbox is used to display number of characters
enterd.
Select you textbox choose events.In events double click on

'TextChanged'

Event and write the below code

if (txtmessage.Text.Length > 0)
{
txtcount.Text = txtmessage.Text.Length.ToString();
}

else
txtcount.Text = Convert.ToString(0);


In form1.cs the complete code is written as follows



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace counttextusingevent
{ public partial class Form1 : Form
{ public Form1()
{
InitializeComponent();
}
private void txtmessage_TextChanged(object sender, EventArgs e) {
if (txtmessage.Text.Length > 0)
{
txtcount.Text = txtmessage.Text.Length.ToString();
}
else
txtcount.Text = Convert.ToString(0);
}
}
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Counting enterd text  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Assembly Entry Point
Previous Resource: How to send selected data from one ListBox to another ListBox?
Return to Discussion Resource Index
Post New Resource
Category: Visual Studio


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use