vb.net - Using a string to represent a control property and a project resource in Visual Basic -


can please me 2 issues? want able use string represent control property in code this.

 dim txtname string = "textbox"  txtname.text = "whatever" 

if process different project resources, can tell me how? want string represent name image in project resources sort of this.

 dim imagename string = "image"     picbox.image = my.resources.image 

i looked directcast , ctype, couldn't find helped me. lot of code didn't work , didn't make sense. i'm looking simplified can guys me?

you arent trying use string represent control property, actual control object. cant convert string variable control object. 2 different things.

one way can use string find control use name of in controls collection:

dim tb textbox = me.controls.find("textbox name find", true) ' if found, tb refers textbox 

note: true param find tells form search child container controls tabs , panels, since control looking may exist in 1 of other control collections.

for resources:

dim resname string = "fuzzybunny" dim bmp bitmap bmp = ctype(my.resources.resourcemanager.getobject(resname), bitmap) 

the identifier has exist , has image or bad things happen. of dubious value because bmp = my.resources.fuzzybunny more straight forward , in both cases, need know name/id of resource.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -