.net - Dynamically Building Buttons -



.net - Dynamically Building Buttons -

i using vb.net. have list of 13 buttons. names of these buttons constructed through combination of 3 different variables.

i need disable these buttons. not want iterate through each button disable them. dynamically phone call these buttons in loop , disable them. this;

for count = 1 13 periodroomid = ("r" & ds.tables("sqlspecroomrequest").rows(i).item(3) & count) periodroomid.enabled = false periodroomid.backcolor = color.gray next

the problem 1 time creating variable periodroomid, can't address button because;

that mean there 2 buttons same name. periodroomid string , hence can't enabled because makes no sense.

how around this?

you can seek controls.find method.

dim cntrl() command count = 1 13 periodroomid = ("r" & ds.tables("sqlspecroomrequest").rows(i).item(3) & count) cntrl = me.controls.find(periodroomid,true) cntrl(0).enabled = false cntrl(0).backcolor = color.gray next

.net vb.net button

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -