vb.net - how to compare (sort) values of dynamically created textboxes? -


i'm doing program aims sort values of dynamically created textboxes. how in vb.net? code creating textboxes:

for cnt = 0 val(textbox1.text) - 1        arrivalbox.add(new textbox)              arrivalbox(cnt)                 .parent = me                 .left = 0                 .height = 13                 .width = 65                 .top = .height * cnt + 50                 .visible = true                 .tag = cnt                 .text = ""                 .name = "arrival" & cnt                 .location = new point(380, 120 + (cnt * 25))                 .textalign = horizontalalignment.center                 .enabled = false                 me.controls.add(new textbox) end 

something loop through textboxes , add them sortedlist sort textboxes according values.

i'm not sure trying achieve here. im guessing once these sorted can change position based on position in sorted list

dim listedboxes sortedlist(of double, textbox) each ctrl control in me.controls             if typeof ctrl textbox                   listedboxes.add(ctrl.value,ctrl)             end if next 

edit maybe this.

 private sub button1_click(sender system.object, e system.eventargs) handles button1.click     dim listedboxes new sortedlist(of double, textbox)     integer = 0 textbox1.text.length - 1         dim tb new textbox         tb             .parent = me             .left = 0             .height = 13             .width = 65             .top = .height * + 50             .visible = true             .tag =             .text = textbox1.text.substring(i, 1)             .name = "arrival" &             .textalign = horizontalalignment.center             .enabled = false             me.controls.add(new textbox)         end         listedboxes.add(textbox1.text.substring(i, 1), tb)     next      dim j = 0     each kvp keyvaluepair(of double, textbox) in listedboxes         kvp.value.location = new point(380, 120 + (j * 25))         j += 1     next end sub 

enter image description here


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -