Solved

TextBox Selection : Display value in Label

Posted on 2004-09-14
3
409 Views
Last Modified: 2012-05-05
I want to dispaly the selected text in a "textbox" in a label
when my app is running.
I have other control also on my form. datagrids  for updating information and other button controls.

So, when the user selects text in the textbox which is bound to a datasource , i need to display the  number of characters in the selected text like this
       
         label.text = textbox.selectedtext.length.tostring();

My question is which event of the textbox do i use.

Enter / Focus/ Leave/ LostFocus etc.

In VS.net in the events list only  "Enter"  is there why?





 
0
Comment
Question by:Jzzzz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
tzxie2000 earned 100 total points
ID: 12058722
I think the code may be in mouseup event and keyup event

private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
  evalSelLen();
}

private void textBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
  evalSelLen();
}

private void   evalSelLen()
{
   Label1.Text=TextBox1.selectedtext.length.tostring();
}
0
 

Author Comment

by:Jzzzz
ID: 12058873
wow.....

exactly!!

I wouldn't have figured that in a hundred years..:)

thanks man.
0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12058892
you're welcome
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding where clause to entity statement c# 1 64
C# XML Get Values 4 54
Building an object from several other objects 4 39
SQL State HYT00. Timeout expired proplem 8 44
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question