473,513 Members | 2,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add lines to textBox.

Hello Group,
I have very simple question. In my application I have textBox (tbInfo) where
tbInfo.Multiline = true;
How simple add lines to this component? Sametime I need add first, sametime
last line.

PawelR
Nov 16 '05 #1
3 18948
Hi Pawel,

You simply use textBox1.Text += "some string";

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"PawelR" <pa************@poczta.onet.pl> je napisal v sporočilo
news:uu**************@TK2MSFTNGP15.phx.gbl ...
Hello Group,
I have very simple question. In my application I have textBox (tbInfo)
where tbInfo.Multiline = true;
How simple add lines to this component? Sametime I need add first,
sametime last line.

PawelR

Nov 16 '05 #2
To insert a line at the start of the textbox:
TextBox.SelectionStart = 0;
TextBox.SelectedText = <text to insert> + Environment.NewLine;

To add to the last line, use TextBox.AppendText() method.

HTH.

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
Hello Group,
I have very simple question. In my application I have textBox (tbInfo) where
tbInfo.Multiline = true;
How simple add lines to this component? Sametime I need add first, sametime
last line.

PawelR

Nov 16 '05 #3
You can also use a StringWriter:

StringBuilder sb = new StringBuilder(TextBox.Text);
StringWriter sw = new StringWriter(sb);

sw.WriteLi ne(NewText);

TextBox.Text = sw.ToString();

it is a little easier to use and can be faster if you are concatentating a
lot.
If you are just doing it a couple of times, then the overhead to initialize
the classes may not be worth it.

"Shiva" wrote:
To insert a line at the start of the textbox:
TextBox.SelectionStart = 0;
TextBox.SelectedText = <text to insert> + Environment.NewLine;

To add to the last line, use TextBox.AppendText() method.

HTH.

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
Hello Group,
I have very simple question. In my application I have textBox (tbInfo) where
tbInfo.Multiline = true;
How simple add lines to this component? Sametime I need add first, sametime
last line.

PawelR

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
16853
by: David Gray | last post by:
Greetings all, I'm working on a program that allows a user to enter notes in a multiline textbox. I would like to be able to read the contents of the textbox (as records - one per line) and...
16
38145
by: Ramsin Savra | last post by:
Hi, What do you suggest to do if I want to do a search in TextBox ? I know that using RichTextBox, we could have Find method to search for a specific word or information but I was wonder if...
22
4484
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
2
9531
by: Becker | last post by:
This is probably a very dumb question, I am using VB.NET 2003 and I see where I can use a method to append text to a textbox, but how about remove? I have a textbox that I continually post log type...
1
2936
by: Shawn | last post by:
Anybody know how to use wordwrap=true and multiline = true on a textbox, but still have the textbox.lines attribute advance if the wordwrap happens? I have a large textbox that is setup like this...
3
2207
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
2
12562
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
10
2442
by: garyusenet | last post by:
I have a multiline textbox. The size of the text box should be 75 characters wide, and 5 lines in height like this: - <---75 characters--> <---75 characters--> <---75 characters--> <---75...
6
16838
by: =?Utf-8?B?SGFucyAtIERpYUdyYXBoSVQgLQ==?= | last post by:
Hi! sorry for a dumb question. I have a textbox where multiline=true and I want to set the scrolbar from none to vertical when the textbox have more then f.ex. 5 lines, or reverse. How can...
3
6038
by: Gregory Leck | last post by:
I can import a .txt document into a TextBox Each line in the TextBox contains a URL, for example, http://www.whateverdomain.com I would like to convert each URL to the following format: <a...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.