Hi there,
Can anyone help me out on this one? i want to read each line entered in a
multiline textbox and store it into an array. I cant find any properties for
this in the control, the only thing i can think of is to use Text.Split and
split the string at each carriage return,
Any help appreciated.
thanks.
Paul 7 45815
Take a look at the TextBox.Lines property. It gets/sets an array of strings
(as opposed to a StringArray)
Mike Ober.
"Milsnips" <mi******@hotma il.comwrote in message
news:ux******** ******@TK2MSFTN GP06.phx.gbl...
Hi there,
Can anyone help me out on this one? i want to read each line entered in a
multiline textbox and store it into an array. I cant find any properties
for this in the control, the only thing i can think of is to use
Text.Split and split the string at each carriage return,
Any help appreciated.
thanks.
Paul
Hi Mike,
only problem is im doing it in c# ASP.NET and .Lines property is not
available here, i think its only in Windows Forms.
regards,
Paul
"Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
news:uk******** ********@TK2MSF TNGP02.phx.gbl. ..
Take a look at the TextBox.Lines property. It gets/sets an array of
strings (as opposed to a StringArray)
Mike Ober.
"Milsnips" <mi******@hotma il.comwrote in message
news:ux******** ******@TK2MSFTN GP06.phx.gbl...
>Hi there,
Can anyone help me out on this one? i want to read each line entered in a multiline textbox and store it into an array. I cant find any properties for this in the control, the only thing i can think of is to use Text.Split and split the string at each carriage return,
Any help appreciated. thanks. Paul
Never mind, i found a solution using
System.Text.Reg ularExpressions .Regex.Split
It allows splitting by a string, instead of a char array.
regards,
Paul
"Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
news:uk******** ********@TK2MSF TNGP02.phx.gbl. ..
Take a look at the TextBox.Lines property. It gets/sets an array of
strings (as opposed to a StringArray)
Mike Ober.
"Milsnips" <mi******@hotma il.comwrote in message
news:ux******** ******@TK2MSFTN GP06.phx.gbl...
>Hi there,
Can anyone help me out on this one? i want to read each line entered in a multiline textbox and store it into an array. I cant find any properties for this in the control, the only thing i can think of is to use Text.Split and split the string at each carriage return,
Any help appreciated. thanks. Paul
Instead of using the regex split, you might want to use the string.Split
method - it's optimized for strings.
Mike.
"Milsnips" <mi******@hotma il.comwrote in message
news:Oe******** *****@TK2MSFTNG P02.phx.gbl...
Never mind, i found a solution using
System.Text.Reg ularExpressions .Regex.Split
It allows splitting by a string, instead of a char array.
regards,
Paul
"Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
news:uk******** ********@TK2MSF TNGP02.phx.gbl. ..
>Take a look at the TextBox.Lines property. It gets/sets an array of strings (as opposed to a StringArray)
Mike Ober.
"Milsnips" <mi******@hotma il.comwrote in message news:ux******* *******@TK2MSFT NGP06.phx.gbl.. .
>>Hi there,
Can anyone help me out on this one? i want to read each line entered in a multiline textbox and store it into an array. I cant find any properties for this in the control, the only thing i can think of is to use Text.Split and split the string at each carriage return,
Any help appreciated. thanks. Paul
Michael D. Ober wrote:
Instead of using the regex split, you might want to use the string.Split
method - it's optimized for strings.
Unless anybody knows of any reason why it should not be used in this
way, I find the following syntax works fine:
string a = (some string with newlines in it)
string[] b = a.Split(new string[] { Environment.New Line},
StringSplitOpti ons.None); http://msdn2.microsoft.com/en-us/library/tabh47cf.aspx
Milsnips wrote:
Never mind, i found a solution using
System.Text.Reg ularExpressions .Regex.Split
It allows splitting by a string, instead of a char array.
Another solution to try if you need to loop through the strings is a
StringReader.
Chris
Unless C# has the equivalant of the VB vbNewLine or the C/C++ '\n' character
strings, this should be the easiest way to split a string. I know that '\n'
is a character and not a string in C/C++. However, the framework's
string.split function takes both.
I would try replacing the second line with
string[] b = a.Split("\n");
If that doesn't work, try
string[] b = a.Split(Environ ment.Newline)
In either case, the string.Split method will work with a string or a
character.
Mike Ober.
"Bobbo" <ro************ @choicequote.co .ukwrote in message
news:11******** **************@ 77g2000hsv.goog legroups.com...
>
Michael D. Ober wrote:
>Instead of using the regex split, you might want to use the string.Split method - it's optimized for strings.
Unless anybody knows of any reason why it should not be used in this
way, I find the following syntax works fine:
string a = (some string with newlines in it)
string[] b = a.Split(new string[] { Environment.New Line},
StringSplitOpti ons.None);
http://msdn2.microsoft.com/en-us/library/tabh47cf.aspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peter Nagel |
last post by:
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
|
by: Michael C |
last post by:
Hi all,
I'm trying to add lines to a multiline textbox. Here's what I'd like to end
up with in the textbox (as an example):
Line1
Line2
Line3
I've tried a couple of methods but nothing seems to be working. Code like
|
by: Olav Tollefsen |
last post by:
I have added a MultiLine TextBox to my aspx page:
<asp:TextBox ID="TextBox1" runat="server" BorderStyle="None" ReadOnly="True"
TextMode="MultiLine"></asp:TextBox>
Then I add two lines of text to it:
TextBox1.Text = "Line 1\r\nLine 2";
The problem is that a vertical scrollbar is displayed
|
by: Flack |
last post by:
Hey guys,
I have two questions regarding the vertical srollbar of a multiline textbox.
1. I have an "Ok" button that is initially disabled. I want it to be enabled
when the user scrolls the vertical scrollbar of a textbox all the way down
(indicating that the user at least pretended to read all of the textbox's
text). How can I monitor the scrollbar and know when it has reached the end?
2. My multiline textbox has VerticalScrollBar...
|
by: Mike |
last post by:
I am trying to write a little program for my own use using VB2005 express edition.
I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox
to enter new, edit existing, and view the names in the array. This all works well, but now I want to be able
to select one more names from the list displayed in the multiline textbox then click a button to copy the
selected names into another list so...
| |
by: Anil Gupte |
last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net.
However, I cannot for the life of me figure out how to write to a multiline
textbox. Basically, I have created an array of strings which I want to
"paste" into a multiline textbox. Any ideas?
--
Anil Gupte
www.keeninc.net
www.icinema.com
|
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.
|
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" TextMode="MultiLine">
Line 1
Line 2
Line 3
</asp:TextBox>
|
by: JohannKotzeVet |
last post by:
Good day!
I have a form in Access that has a multiple line textbox (I called it cAbnormalities). This text box is populated by the user ONLY through selection of options from combo boxes. I want the selected options to each be in a seperate line, and I don't want the user to be able to edit the textbox without using the combo boxes.
Here is my code when a selection is made from the combo box:
Me.cAbnormalities.Locked = False...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |