Wednesday, 15 August 2012

Split String and add in combobox in c# -


I am getting the data from the database and adding it to the combobox. The string contains a list of names of commas.

Detroit Dr. = New Ro [i]; TraineeCombo.Items.Add (.dw ["Trainee"] ToString ());

This works fine, but I want to split the string and add each item to the combo box. I tried the methods below.

  Detroit Dr. = newdt.Rows [i]; String tiptt = dr ["trainee"]. Toasting (); String [] results = tempTr.Split (new four [] {','}); Foreign language (resulting string) {If (S.Rim!) = "") Trainee Combo ITEM Add (s); }  

The second method:

  string prompt = Dr. ["trainee"]. Toasting (); TraineeCombo.Items.AddRange (TempTr.Split (','));  

But it shows both methods as an error

The string can not be converted into four [] and invalid arguments. I found this piece of sample code from MSDN. How can I solve it?

try it

Detroac Dr. = New Ro [i]; String tiptt = dr ["trainee"]. Toasting (); String [] results = TempTr.Split (','); Foreign language (resulting string) {If (S.Rim!) = "") Trainee Combo ITEM Add (s); }

No comments:

Post a Comment