473,569 Members | 2,880 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting strings in a multiline TextBox control

I would like to insert some strings in a multiline TextBox. At the time of
inserting the TextBox already contains some strings each in a separate line.
The new lines should be inserted somewhere in the middle of the existing
lines moving some line to higher indices of the Lines property.

What would be a good solution for my little problem?

Greetings from Germany,

Peter
Nov 16 '05 #1
5 2621
Peter,

You can use the Lines property on the TextBox to do this for you. Quite
simply, get the array returned by the Lines property. Create a new array
that has your new line inserted, and then set the Lines property to that
array.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Peter Nagel" <pe***********@ yahoo.de> wrote in message
news:2h******** ****@uni-berlin.de...
I would like to insert some strings in a multiline TextBox. At the time of
inserting the TextBox already contains some strings each in a separate line. The new lines should be inserted somewhere in the middle of the existing
lines moving some line to higher indices of the Lines property.

What would be a good solution for my little problem?

Greetings from Germany,

Peter

Nov 16 '05 #2
Hello Nicholas,

thank you for your answer supporting my first steps in C# after some years
experience with Borland's Delphi.

Peter
Nov 16 '05 #3
Nicholas Paldino [.NET/C# MVP] wrote:
Peter,

You can use the Lines property on the TextBox to do this for you.
Quite simply, get the array returned by the Lines property. Create a
new array that has your new line inserted, and then set the Lines
property to that array.


Is that the (only) way to do it?
It seems overly complicated, compared to e.g. Items.add.

--
Thomas Due
Posted with XanaNews version 1.16.3.1

"Insanity in individuals is something rare - but in groups, parties,
nations and epochs, it is the rule."
-- Friedrich Nietzsche
Nov 16 '05 #4
Hi,
This is a silly question but how do I connect to a specific database using
DMO.
SQLDMO.SQLServe rClass srv;

srv = new SQLServerClass ();

srv.LoginSecure =true;

srv.Connect ("stgnyc002" , "user", "psd");

SQLDMO.Database db = srv.Databases(" pubs"); // This doesn't work.

Thanks in advance for any help.

Asim.


"Thomas Due" <tdue@mail_remo ve_.dk> wrote in message
news:e9******** ********@TK2MSF TNGP11.phx.gbl. ..
Nicholas Paldino [.NET/C# MVP] wrote:
Peter,

You can use the Lines property on the TextBox to do this for you.
Quite simply, get the array returned by the Lines property. Create a
new array that has your new line inserted, and then set the Lines
property to that array.


Is that the (only) way to do it?
It seems overly complicated, compared to e.g. Items.add.

--
Thomas Due
Posted with XanaNews version 1.16.3.1

"Insanity in individuals is something rare - but in groups, parties,
nations and epochs, it is the rule."
-- Friedrich Nietzsche

Nov 16 '05 #5
Hi Thomas

You can always append to the text property Using something like this
Text1.Text += String.Format(" {0}{1}","You Text Here",Environme nt.NewLine) ;

Depending how and how much you want to add to the text box you can use the
StringBuilder to (populate and add a newline) to your text and then use the
same method above.

However, I personally think the Lines property is a cleaner and better
approach :-)

Henk

"Thomas Due" <tdue@mail_remo ve_.dk> wrote in message
news:e9******** ********@TK2MSF TNGP11.phx.gbl. ..
Nicholas Paldino [.NET/C# MVP] wrote:
Peter,

You can use the Lines property on the TextBox to do this for you.
Quite simply, get the array returned by the Lines property. Create a
new array that has your new line inserted, and then set the Lines
property to that array.


Is that the (only) way to do it?
It seems overly complicated, compared to e.g. Items.add.

--
Thomas Due
Posted with XanaNews version 1.16.3.1

"Insanity in individuals is something rare - but in groups, parties,
nations and epochs, it is the rule."
-- Friedrich Nietzsche

Nov 16 '05 #6

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

Similar topics

7
4021
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also,...
2
4596
by: Chris | last post by:
Hi We are using style sheets to set the font of our labels and text boxes. This has been working great until we required a text box with a textmode of Multiline. The control picks up the correct font/size until the text mode is changed from single line to multiline. We're currently using the H1, H2, H3 and Body tags for the page.
1
3833
by: ABC | last post by:
I tried KDNGrid's (www.knowdotnet.com) Multiline textbox column style for datagrid. It is very good but has some bug on wrong handle datagrid height that cannot display the scrollbar when a row has multiline textbox inserted. I need to force insert more and more row lines, the scrollbar of gridbox displayed. Is there any another good...
4
5154
by: ramesh_tankala | last post by:
Hi,,,friends.. i am using multiline text box for storing address ,suppose my multiline control(address) is 2nd one,suppose i move from 1st control to 2nd(address) my cursor placed in begining of the text existed in multiline text box(address).i want to cursor end of the text existed in multiline textbox
2
2270
by: Pieter | last post by:
Hi, Using this Multiline Combobox(http://www.vbcity.com/forums/faq.asp?fid=15&cat=ListBox%2FComboBox#TID58434), doesn't allow the user to type multi line text in the texbox-part of the combobox. Does anybody has any idea how to achieve this? What should I override to draw a multiline-textbox instead oth the default textbox? Thanks a lot...
4
2071
by: zacks | last post by:
I am developing a C#.NET application in VS2005 that needs a function that allows the user to edit some text content stored in a Text column in a database. I have a TextBox control with AcceptsReturn, AcceptsTab and MultiLine properties all set to True. When I set the Text property of the control to the string returned from the database and...
4
3809
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In multiLine textBox, enter moves to the next line, how can i overwrite it, so enter will move to the next control and ctrl + enter will move to the next line? Thanks, Gidi.
2
5800
by: Nathan Sokalski | last post by:
I have a multiline TextBox that I want to display the text used to create a control in an apsx file. I want each of these to be on a separate line in the TextBox. The only way I know of to place things on separate lines in a TextBox without doing it programmatically is the following: <asp:TextBox ID="txtMultiLine" runat="server"...
0
2847
by: evilson | last post by:
Hi, I have two textbox, one of the textbx is is set to multiline. Problem is when i try to insert the value of the multiline textbox to the datagridview, it never work. The datagrid's warpmode is already set to true but the value doesnt change. this is the code: .DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(0).Value =...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1229
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.