Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TextBox Selection : Display value in Label

Posted on 2004-09-14
3
Medium Priority
?
416 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

704 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