[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TextBox text spliting problem C#

Posted on 2009-04-27
4
Medium Priority
?
576 Views
Last Modified: 2012-08-13
Hi,
I'm trying to Split a Text Box text containing something like
12: Australia(country)
I just want the "12" element, I tried "string[] loca = textbox1.Text.Split(":");" but the compilation error of
"The best overloaded method match for 'string.Split(params char[])' has some invalid arguments" and "Argument '1': cannot convert from 'string' to 'char[]'" kept blocking.

Thanks for the help in advance.
0
Comment
Question by:csharp_learner
  • 2
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 1000 total points
ID: 24247313
try:

string[] params = {':'};// cretae params array
textbox1.Text.Split(params);
0
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 24247327
Sorry,

it should be
string[] params = {":"};// cretae params array - quotas


or


char[] params = {':'};// cretae params array - single quotas
0
 

Author Comment

by:csharp_learner
ID: 24247372
Thanks for the reply.
How can i get the "12" from
            char[] para = { ':' };
            textbox1.Text.Split(para);
0
 

Author Comment

by:csharp_learner
ID: 24247484
Thanks for the help
           char[] para = { ':' };
           string[] store =  textbox1.Text.Split(para);
Worked for me.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question