O Offbeatmammal Member Licensed User Jun 1, 2008 #1 I've got a number of fields on a form (all called "txt{something}" eg txtHomeTelephoneNumber) and I want to be able to quickly set them in code, ideally without typing every time txtHomeTelephoneNumber.Text = PimContact.HomeTelephoneNumber is there a quicker way (or at with least less typing)? for instance in classic ASP I could do setField(fldName) sub setField(fldName) eval("txt" & fldName & ".Text = PimContact." & fldName) end sub I know I'm just being lazy
I've got a number of fields on a form (all called "txt{something}" eg txtHomeTelephoneNumber) and I want to be able to quickly set them in code, ideally without typing every time txtHomeTelephoneNumber.Text = PimContact.HomeTelephoneNumber is there a quicker way (or at with least less typing)? for instance in classic ASP I could do setField(fldName) sub setField(fldName) eval("txt" & fldName & ".Text = PimContact." & fldName) end sub I know I'm just being lazy
agraham Expert Licensed User Longtime User Jun 1, 2008 #2 Check out Help->Main Help->Keywords->Runtime control manipulation->Control
O Offbeatmammal Member Licensed User Jun 1, 2008 #3 that lets me get at the value for the control on the form so I can do the the Control("txt" & fldName).Text part of the process but... doesn't seem to want to let me access the corresponding PimContact (Outlook Contact) field unless I'm missing something (quite likely!) both Control("PimContact." & fldName) and Control("PimContact").fldName give me a compile error and Control("PimContact","Contact").Control(fldName) gave me a runtime error any suggestions? not critical, just reduces my typing considerably
that lets me get at the value for the control on the form so I can do the the Control("txt" & fldName).Text part of the process but... doesn't seem to want to let me access the corresponding PimContact (Outlook Contact) field unless I'm missing something (quite likely!) both Control("PimContact." & fldName) and Control("PimContact").fldName give me a compile error and Control("PimContact","Contact").Control(fldName) gave me a runtime error any suggestions? not critical, just reduces my typing considerably
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2008 #4 You can't evaluate the method or property name at runtime. Only the object name can be evaluated.