function - loop many combobox in vb.net -


i creating gpa calculator 10 combo boxes (cmbgrade1, cmbgrade2, cmbgrade3,...,cmbgrade10) select grade points , 10 text boxes(textbox1,textbox2,textbox3,...,textbox10) enter credits , have created function apply each combo boxes have multiply textbox.text cmbgrade.selecteditem next it.

i'm using loop call funtion ten combo boxes please guide me loop combo boxes

public function gpa(byval grade single, byval credit single)     return grade * credit end function 

as blue dog mentioned in comment function should return value. can use link if unaware difference between function , sub. can use following code loop through the controls inside form control. hope you.

consider following 2 methods:

private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click     integer = 0 2         dim combo combobox = directcast(me.controls.find("cmbgrade" & i, true)(0), combobox)         dim txtbox textbox = directcast(me.controls.find("textbox" & i, true)(0), textbox)         dim x = gpa(csng(combo.selecteditem), csng(txtbox.text))     next end sub  public function gpa(byval grade single, byval credit single) single     return grade * credit end function 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -