Monday, 15 August 2011

vb.net - How to get 4 inputs from an input box -



vb.net - How to get 4 inputs from an input box -

i've created form want command course of study registration process.

so codes follows

private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim integer dim inpname string = 1 4 inpname = inputbox("what course of study want register") if inpname = "computer literacy" textbox1.text = inpname elseif inpname = "engineering" textbox1.text = inpname else msgbox("we offer computer literacy , engineering") end if next

i want loop take computer literacy or engineering science 4 times , tell user computer literacy course of study or engineering science course of study full.

hope helps

dim integer dim inpname string dim engineering science integer = 0 dim complit integer = 0 = 1 4 inpname = inputbox("what course of study want register") if inpname = "computer literacy" complit = complit + 1 textbox1.text = inpname elseif inpname = "engineering" engineering science = engineering science + 1 textbox1.text = inpname else msgbox("we offer computer literacy , engineering") end if if complit = 4 msgbox("computer literacy full!") elseif engineering science = 4 msgbox("engineering full!") end if next

i wanted add together explanation of happening here. 2 variables engineering science , complit created , given 0 value on button click. loop happens , each time 1 of values correctly inputted, variables increment 1. @ end of each loop, values checked see if 4 , associated message displayed. if either not 4, no message since classes not full.

vb.net

No comments:

Post a Comment