Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. void with_Items_AddRange_DataSource()
  2. {
  3. string[] x = new string[4];
  4.  
  5. x[0] = "1";
  6. x[1] = "2";
  7. x[2] = "11";
  8. x[3] = "22";
  9.  
  10. //listBox1.Items.AddRange(x);// by default no item is selected
  11. listBox1.DataSource = x; // by default the first item is selected
  12. }
  13. void with_Items_Add()
  14. {
  15. string[] x = new string[4];
  16.  
  17. x[0] = "1";
  18. x[1] = "2";
  19. x[2] = "11";
  20. x[3] = "22";
  21.  
  22. for (int i = 0; i < x.Length; i++)
  23. listBox1.Items.Add(x[i]); // by default the first item is selected
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement