Reputation: 65
anyone have any idea how to increase a label to 2(or more) messages whenever there are 160 characters or more in a text box?
Upvotes: 1
Views: 551
Reputation: 1035
Create an Event to change the text in the textbox, calculate number of characters there. Then check for the required characters to reach the limit, and increase the label text value as shown below,
private void txtSearchMember_TextChanged(object sender, EventArgs e)
{
if (txtSearchMember.Text.Length >= 160)
{
lblMessageCount.Text = 1; // Increase count with simple maths
}
}
Upvotes: 3