Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi sir/madam

may i know how to find the range of array elements by enter the values in Textbox like 3,45,76,24,43. that result will display in other textbox. is this possible?


thank u.
Posted
Comments
Denis Shemenko 2-Jul-13 3:55am    
Hi!
What you mean by "range" of array?
Maybe length?)
radha18 2-Jul-13 3:58am    
yes, its length
jaideepsinh 2-Jul-13 3:57am    
Sorry,
But can you explain in brief what you want to do.If you want to know size of array then its depend on datatype which you use.
radha18 2-Jul-13 4:03am    
i am taking in textbox so its text format. how we remove that comos and how to find length of that array. and display in another textbox.

1 solution

If length then this is very simple:

// You take your input value as string
C#
string input = textBox_1.Text;

// Then you split this string with those character that you choose
// and you've got array of strings
C#
string[] arr = input.Split(',');

// And for the end you output array length in the second text box
C#
textBox_2.Text = arr.Length;
 
Share this answer
 
Comments
radha18 2-Jul-13 5:01am    
thank u so much for clarifying.
Denis Shemenko 2-Jul-13 5:03am    
You are welcome :)
radha18 2-Jul-13 5:51am    
now the array is stored into string format but how to convert the string array to integer array. then how to find the biggest and smallest element among those elements. and print that in another textbox.
Denis Shemenko 2-Jul-13 7:48am    
Just convert all items in array through the loop into Integer.
About loops - http://www.dotnetperls.com/loop
About converting - http://msdn.microsoft.com/en-us/library/vstudio/bb397679.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900