vb.net - Visual basic - Questlon -
how have button generate number 0-255 (randomly) force display textbox in form field? make counts times have clicked button , have force text textbox?
also how force textbox can input number 0-255.
another question when "application.restart()" how force display top application (over other programs running.) on reload.
for first value, use numericupdown instead of textbox. restrict integer values , allow specify minimum value (0) , maximum value (255). button can make use of random class , simple counter variable. display number of clicks in label value isn't meant changed user:
public class form1 private sub form1_load(sender object, e system.eventargs) handles me.load numericupdown1.minimum = 0 numericupdown1.maximum = 255 label1.text = "clicks: 0" end sub private sub button1_click(sender system.object, e system.eventargs) handles button1.click static r new random static counter integer = 0 numericupdown1.value = r.next(numericupdown1.maximum + 1) counter = counter + 1 label1.text = "clicks: " & counter end sub end class
Comments
Post a Comment