vb.net - Declaring a one dimensional array of 6 and showing a random value between 1-6 in a textbox -
i need program. declared one-dimensional array of 6 , want show random values between 1-6 in text box
my question how show values in array in textbox1.text?
here code:
public sub clickmyfirstclassbutton() if firstclass.checked = true 'this piece of code declares array dim seats integer() 'this 1 dimensional array redim seats(6) textbox1.text = (string.format("first class checked. number of seats : ", (seats))) 'elseif firstclass.autocheck = true 'messagebox.show("firstclass auto checked") end if end sub
i messed around program , did.
public sub clickmyfirstclassbutton()
if firstclass.checked = true 'dim seats integer() = {1, 2, 3, 4, 5, 6} dim seats(0 6) integer seats(0) = 1 seats(1) = 2 seats(2) = 3 seats(3) = 4 seats(4) = 5 seats(5) = 6 textbox1.text = (string.format("first class checked. seat : {0}", seats(randomnumber(seats)))) messagebox.show(string.format("first class checked. seat : {0}", seats(randomnumber(seats)))) 'elseif firstclass.autocheck 'messagebox.show("firstclass auto checked") end if end sub
where have "(seats)", replace string.join(", ", seats) , see if results.
(though admit i'm not sure has random values, should display values in array.)