anjumathi kumar

anjumathi kumar

  • NA
  • 54
  • 64.4k

C# Question

Jul 5 2011 2:01 AM
Hi

In a popup i have a multiline textbox .in that i type five names like

mahi
moni
soni
suji
krish

if i give ok mean it want to store temporary variable using array list
and want to select any one name using random function..

i tried this coding







{



a2.Add(item);


rno1 = randmname.Next(a2.Count);
rno2 = a2[rno1].ToString();


}
private static int rno, rno1;
private static string rno2;
private string stringToArrayList(string MyValue)
{
ArrayList a2 = new ArrayList();
string[] s = MyValue.Split(new char[] { ',' });
foreach (string item in s)
a2.Add(item);
Random
randmname = new Random();
rno1 = randmname.Next(a2.Count);
rno2 = a2[rno1].ToString();



return rno2;
}

i am passing my textbox.textcontent in this function.

here am getting like all names mahimonisonisujikrish  in single line


but i want to generate random names from this list

how can i change

Answers (1)