Posted on: 5/9/2011 5:49:15 AM | Views : 225

hi,
i have list of 5 to 6 numbers, im keeping in array.
and i have one text box where i enter a number must be in the araay list or it should show message box.
for this im doing in following way.
private void txtDistance_KeyDown(object sender, KeyEventArgs e) { int[] a ={10,20,30,40,50 }; for (int i = 0; i < 5; i++) { if (int.Parse(txtDistance.Text.ToString()) != a[i]) { MessageBox.Show("not valid distance"); } } }
here the problem for me is for each and every index of the array message box is poping up. but  i want to show it only when the entered distance is not from the array list.
plz help.
thanking you.
 
...

Go to the complete details ...