how can i split sting in textbox in windows application using
c# .net

Answers were Sorted based on User's Feedback



how can i split sting in textbox in windows application using c# .net..

Answer / suresh

DropDown spliting numbers1-100,101-200,...901-1000

ddlnumbers.Items.Clear();
string s=ddlselct.SelectedItem.ToString();
string[] value = s.Split('-');

var v1 =Convert.ToInt32(value[0]);
var v2 =Convert.ToInt32(value[1]);

for (int i = v1; i <= v2; i++)
{
ddlnumbers.Items.Add(i.ToString());
}

Is This Answer Correct ?    4 Yes 0 No

how can i split sting in textbox in windows application using c# .net..

Answer / sasd

string s = in_txt.Text;
string[] a;
// Split string on spaces.
// ... This will separate all the words.
//
string[] words = s.Split(' ');
foreach(string word in words)
{
for (int i = 0; i <= 3; i++)
{
a[i] = word;
}

Is This Answer Correct ?    11 Yes 15 No

Post New Answer

More C Sharp Code Interview Questions

Code for Reading and writing from a file in c#?

1 Answers  


Write a function which accepts a sentence as input parameter.Each word in that sentence is to be reversed. Space should be there between each words.Return the sentence with reversed words to main function and produce the required output. for eg:- i/p: jack jill jung kill o/p: kcaj llij gnuj llik

1 Answers   Mind Tree,


Code for Searching for Multiple Matches with the MatchCollection Class?

0 Answers   TCS,


IS Array list is generic or non generic

1 Answers  


how to get the table names via c sharp and column names also?

2 Answers   Sify,


Give the code for Handling Mouse Events?

0 Answers  


I am developing a web application using google map api.I want to update the map inside the div control within update panel. I got other controls updated but map doesn't get updated.I do not not want to update map whenever unnecessary controls are fired at server side.How could it be achieved?

0 Answers  


Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.

1 Answers   Cognizant,


write a Program to copy the string using switch case.

0 Answers   Mind Tree, Wipro,


program to check if a number is "perfect number".

1 Answers   Mind Tree, SoftSol,


How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)

0 Answers  


Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number.

1 Answers   Infosys, Mind Tree,


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)