vb.net - VB2010 for x in y equivalent -


trying vb first time , need help.

i have list box run same task each of lostbox items when button clicked. in python use for x in y:

but do vb?

code far

button5_click(byval sender system.object, byval e system.eventargs) handles button5.click  dim mesg string dim pw string dim id string integer = 0 me.listbox2.items.count - 1  id = me.listbox2.items(i).tostring  mesg = textbox1.text.tostring()           pw = "s"  messagebox.show(id & mesg & pw, "test") exit     next end sub 

so want message box each item in listbox once ok has been clicked

vb has many, many ways make loop.

seems you've encountered for...next loop construct.

python's for x in y sounds vb's for each...next loops:

dim message string = textbox1.text; dim pw string = "s";  dim item string each item in listbox2.items     messagebox.show item & message & pw, "test" next 

i'd recommend read vb loop structures on msdn


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -