IT Community - Software Programming, Web Development and Technical Support

Label Question

This is a discussion on Label Question within the C# Programming forums, part of the Software Development category; Label Question Hi, i want to get a code were when i load something in a textbox i have another ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 05-25-2009, 11:29 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Label Question

Label Question


Hi,

i want to get a code were when i load something in a textbox i have another label tht is like 0/0 and when i load something in textbox in will show up like 0/100 or how ever many lines are being used.....for example if i have 150 lines being used i want it to show 0/150...on vb8 plz..ty
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-25-2009, 11:30 PM
shaalini shaalini is offline
D-Web Architect
 
Join Date: Apr 2007
Posts: 633
shaalini is on a distinguished road
Default Re: Label Question

Hi,

i am writing the following code for your reference.


Me.TextBox1.Text = "aaaaaaaaaaaabbbbbbbbbbbbbbbbbbb" + Environment.NewLine
Me.TextBox1.Text += "bbadfadfasdfdsfdsfdfdfsafdsfd" + Environment.NewLine

Dim str As String = String.Format("0/{0}", TextBox1.Lines.Count.ToString())
Me.Label1.Text = str


If you have any problem regarding the code , please feel free to let me know.
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-25-2009, 11:31 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Re: Label Question

Hi all,

wht do i put code under....textbox...label or the load button
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-25-2009, 11:41 PM
shaalini shaalini is offline
D-Web Architect
 
Join Date: Apr 2007
Posts: 633
shaalini is on a distinguished road
Default Re: Label Question

Hi ,

You can put the code in the place as you need.

For example, if you want the label to show the string when the form is loading, you can put this in the Load event handler of the Form. Else if you want the label to show the string when the button is clicked, you can put the code in a button clicked event handler.

If you want the text in the Lable change when you input in the TextBox, then you may need to put the code in the KeyPress or TextChanged event handler of the TextBox.
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 05-25-2009, 11:41 PM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Re: Label Question

Hi,


thanks and is there also a way when you load something in the textbox to have the first one highlighted so when you run it you dont have to click it
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 05-25-2009, 11:43 PM
shaalini shaalini is offline
D-Web Architect
 
Join Date: Apr 2007
Posts: 633
shaalini is on a distinguished road
Default Re: Label Question

Hi all,

I think you want partial Text of TexBox highlighted when the form is loaded. You can set the SelectionStart property and SelectionLength property to achieve the goal.

Here is the code:

Me.TextBox1.Text = "How's your problem now?"+Environment.NewLine;
Me.TextBox1.Text +="Yes, it's Ok now. Thank you very much";
Me.TextBox1.SelectionStart = 0;
Me.TextBox1.SelectionLength = 5;
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mac OS X question ventyra Operating Systems 1 12-17-2007 07:48 PM
question iyyappan Flash Actionscript Programming 3 12-06-2007 12:45 AM
create Editable label without postback shaalini ASP and ASP.NET Programming 4 10-18-2007 01:18 AM
css question muthukumar HTML, CSS and Javascript Coding Techniques 0 07-17-2007 11:02 AM
SEO Question nhoj Search Engine Optimization 6 04-26-2007 11:03 PM


All times are GMT -7. The time now is 02:49 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0