473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

working with a string from a textbox

I have a value in a text box pulled in from a dataadapter. This text might
be "Black White Tan". If it is, then I want to have three other boxes and
will fill with these colors. That part I know how to do, but I have not
really had to manipulate a string before. How would I pull apart the above
string to assign the colors to three boxes?

Just some other information, this value will always contain spaces between
the colors, this value is required; this value is either one, two or three
colors - never any more.

Thanks for any information.

Brad
Nov 20 '05 #1
2 960
Hi, AllcompPC

You can use regex (see Regex class) to do what you want to do. Basic
expression, which can get you started is

Match m = Regex.Match(inputString, "(\w+\s)+"

You can check Groups, Matches and Captures collections, what they have
inside.
As soon as you have complete string with color name you can create your
color using this string. See Color class.

HTH
Alex

"AllcompPC" <al*******@sbcglobal.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
I have a value in a text box pulled in from a dataadapter. This text might be "Black White Tan". If it is, then I want to have three other boxes and
will fill with these colors. That part I know how to do, but I have not
really had to manipulate a string before. How would I pull apart the above string to assign the colors to three boxes?

Just some other information, this value will always contain spaces between
the colors, this value is required; this value is either one, two or three
colors - never any more.

Thanks for any information.

Brad

Nov 20 '05 #2
Use String.Split to split your value into different color strings
Then use Color.FromName to get a color object

/claes

"AllcompPC" <al*******@sbcglobal.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
I have a value in a text box pulled in from a dataadapter. This text might be "Black White Tan". If it is, then I want to have three other boxes and
will fill with these colors. That part I know how to do, but I have not
really had to manipulate a string before. How would I pull apart the above string to assign the colors to three boxes?

Just some other information, this value will always contain spaces between
the colors, this value is required; this value is either one, two or three
colors - never any more.

Thanks for any information.

Brad

Nov 20 '05 #3

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

Similar topics

0
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
1
by: tshad | last post by:
I can't seem to get insert into a DataGrid to work. I am using an example from the net and made changes to work on my computer. The grid comes up fine. The edit boxes in the footer are there. ...
1
by: Schultz | last post by:
Hi, i am trying to make a fully editable dataGrid and was using the "Top Ten Questions about the DataGrid Control" article in the MSDN Library as a guide. The following is my current vb code. I ran...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
0
by: pd123 | last post by:
I'm new to C# and .net and I'm trying to create a form that will register users in a sql server database. I have the following code but when I run the code I get an error " The name 'Peter' is...
2
by: Michael Appelmans | last post by:
I have essentially copied the samplelist2.aspx from the Atlas samples but the autocomplete feature is not working in my page. The web service asmx works from a browser. Thanks for any suggestions...
4
by: Tomasz Jastrzebski | last post by:
Hello Everyone, I have a GridView control bound to a plain DataTable object. AutoGenerateEditButton is set to true, Edit button gets displayed, and RowEditing event fires as expected.
1
by: Nick C | last post by:
Hi I would like to insert a new row in this gridview but the showfooter=true is not working? thanks N <%@ Page Language="VB" %>
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I am using an ajax masked edit extender along with a text box and masked edit validator and calendarExtender. It was working correctly but now for some reason when the user selects the image...
2
by: pankajsingh5k | last post by:
Dear All, Please help me... I had read an article to lazy load a tab in a tabcontainer using an update panel on http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...

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.