i'm asking something, multiline add text on first line, instead of above, reversing.
when click button want text in label go multiline textbox, in case there 3 multiline texboxes:
i want reverse result of this:
- text line 1
- text line 2
- text line 3
and have this:
- text line 3
- text line 2
- text line 1
but there said there 3 multiline textbox, 1 red numbers, 1 zeros, , black numbers. roulette game, when random number generated number go 1 of textbox (according color), , when generate more numbers old ones going down till there no more text box left , disapear, , new ones apear on first line.
so have code:
static int[] preto = new int[] { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; static int[] vermelho = new int[] { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; (int l = 0; l < 18; l++) { if (lbl_random.text == "0") { txt_zeros.text += lbl_random.text + "\r\n"; txt_vermelhos.text += "\r\n"; txt_pretos.text += "\r\n"; } else if (int.parse(lbl_random.text) == preto[l]) { txt_zeros.text += "\r\n"; txt_pretos.text += lbl_random.text + "\r\n"; txt_vermelhos.text += "\r\n"; } else if (int.parse(lbl_random.text) == vermelho[l]) { txt_vermelhos.text += lbl_random.text + "\r\n"; txt_pretos.text += "\r\n"; txt_zeros.text += "\r\n"; }
instead of multiline textbox try use listbox 3 situations.
notice should convert label 1 time , use indexof (or contains) on arrays. no need build loop
static int[] preto = new int[] { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; static int[] vermelho = new int[] { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int number = convert.toint32(lbl_random.text); if (number == 0) { lstzeros.items.insert(0, "0"); lstvermelhos.items.insert(0, ""); lstpretos.items.insert(0, ""); } else if (preto.contains(number)) { lstzeros.items.insert(0, ""); lstvermelhos.items.insert(0, ""); lstpretos.items.insert(0, number.tostring()); } else { // black.... lstzeros.items.insert(0, ""); lstvermelhos.items.insert(0, number.tostring()); lstpretos.items.insert(0, ""); }
in listbox numbers stored in items collection , scroll , see sequence of items inserted
Comments
Post a Comment