473,511 Members | 14,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

splitting a string into a drop down

I have a string of dates seperated by commas and I need to seperate them and
put them into a dropdown control. With the code below I am able to only
remove the comma which results in one big long string with no spaces and the
string is listed 5 time. How can I seperate the dates into seperate strings.

Here is the code I have so far:

string strDelim = ",";
char[] charDelim = strDelim.ToCharArray();
string Dates = StartDate;
string[] splitDates = null;

for (int x = 1; x <= 5; x++)
{
splitDates = Dates.Split(charDelim, x);
foreach (string s in splitDates)
{
SelectDate.Items.Add(s);
}
}

Thanks, Justin.
Nov 18 '05 #1
1 1693
Is this what you want?

string[] splitDates = StartDate.Split(',');
for (int i = 0 ; i < splitDates.Length; ++i){
SelectDate.Items.Add(splitDates[i]);
}

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:EA**********************************@microsof t.com...
I have a string of dates seperated by commas and I need to seperate them and put them into a dropdown control. With the code below I am able to only
remove the comma which results in one big long string with no spaces and the string is listed 5 time. How can I seperate the dates into seperate strings.
Here is the code I have so far:

string strDelim = ",";
char[] charDelim = strDelim.ToCharArray();
string Dates = StartDate;
string[] splitDates = null;

for (int x = 1; x <= 5; x++)
{
splitDates = Dates.Split(charDelim, x);
foreach (string s in splitDates)
{
SelectDate.Items.Add(s);
}
}

Thanks, Justin.

Nov 18 '05 #2

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

Similar topics

6
2454
by: PT | last post by:
I got a form with many text boxes, checkboxes and 3 drop downs. From that 3, 2 are dependant. I can choose one drop down, and the next drop down should display the dependant values of the first...
3
6142
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box...
2
12595
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
4
9273
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
2
3252
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to...
6
3718
by: nbomike | last post by:
I am trying to integrate a custom page into a shopping cart app written in PHP. The custom page is basically a part finder widget that helps customers find a car part based on the car's make, model,...
6
1695
by: jacc14 | last post by:
Good morning all. I have been working on a database for the past couple of weeks and it is pretty nippy. I have an ODBC link in there from another software program. Since splitting it and...
2
1213
by: IanSD81 | last post by:
Does anyone know How to go about having an item in a drop down box which shows up a string but holds a numerical value or to have a word selected in a drop down box and have it hold a value that...
3
5853
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I...
0
7252
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
5676
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
5077
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
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 ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
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...

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.