vb.net - Access a dynamically created textbox text from another sub. And I also want to be user-configurable and access the user-configured text -
textbox.text want access. , want user-configurable before want access altered text.
dim qbox new textbox qbox.size = new size(20, 20) qbox.location = new point(90, 10) qbox.parent = addtocart qbox.name = "quarts" qbox.text = "ss"**
how dynamically add inside series of other dynamic controls:
tile.controls.add(addtocart) flpp.controls.add(tile) tile.controls.add(plabel) tile.controls.add(nlabel) addtocart.controls.add(qbox)
how tried access it:
qb.text = ctype(me.controls("flpp").controls("tile").controls("addtocart").controls("qbox"), textbox).text
i generated textbox @ runtime. of course it's dynamic. i'm new vb , i'm experimenting school project. wanted textbox text configurable , access configured value. i've been brain-cracking days this. when run thing, "getobject reference not set instance of object." under nullreferenceexception unhandled" this. don't it.
winforms? if yes, , want find control "by name", use controls.find() function:
dim ctlname string = "quarts" dim matches() control = me.controls.find(ctlname, true) if matches.length > 0 andalso typeof matches(0) textbox dim tb textbox = directcast(matches(0), textbox) ' ... use "tb" somehow ... dim value string = tb.text messagebox.show(value) end if
Comments
Post a Comment