|
OK 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 |
| __M4D_M0F0__ Monday, March 30, 2009 12:37 PM |
Hi _M4D_M0F0_, I'm 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. Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byBruce.ZhouMSFT, ModeratorFriday, April 03, 2009 10:06 AM
-
|
| Bruce.Zhou Tuesday, March 31, 2009 11:51 AM |
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;
Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byBruce.ZhouMSFT, ModeratorFriday, April 03, 2009 10:06 AM
-
|
| Bruce.Zhou Friday, April 03, 2009 2:36 AM |
Hi _M4D_M0F0_, I'm 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. Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byBruce.ZhouMSFT, ModeratorFriday, April 03, 2009 10:06 AM
-
|
| Bruce.Zhou Tuesday, March 31, 2009 11:51 AM |
wht do i put code under....textbox...label or the load button |
| __M4D_M0F0__ Wednesday, April 01, 2009 9:38 PM |
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. Feel free to let me know if you have any further problems or concerns. Best regards, Bruce Zhou Please mark the replies as answers if they help and unmark if they don't. |
| Bruce.Zhou Thursday, April 02, 2009 2:04 AM |
thanks alot bro...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
|
| __M4D_M0F0__ Thursday, April 02, 2009 7:22 PM |
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;
Best regards, Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't. - Marked As Answer byBruce.ZhouMSFT, ModeratorFriday, April 03, 2009 10:06 AM
-
|
| Bruce.Zhou Friday, April 03, 2009 2:36 AM |