Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

eval or similar to execute statements

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-01-2008, 07:26 PM
Junior Member
 
Join Date: May 2008
Posts: 33
Default eval or similar to execute statements

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
Reply With Quote
  #2 (permalink)  
Old 06-01-2008, 08:33 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Check out Help->Main Help->Keywords->Runtime control manipulation->Control
Reply With Quote
  #3 (permalink)  
Old 06-01-2008, 10:22 PM
Junior Member
 
Join Date: May 2008
Posts: 33
Default

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
Reply With Quote
  #4 (permalink)  
Old 06-02-2008, 04:52 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You can't evaluate the method or property name at runtime. Only the object name can be evaluated.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
New feature: Similar Threads Erel Forum Discussion 0 01-23-2008 02:15 PM
Sound Lib Similar to Image Lib Louis Basic4ppc Wishlist 0 06-29-2007 03:16 AM
execute , run , another application giannimaione Questions (Windows Mobile) 3 05-04-2007 09:04 PM


All times are GMT. The time now is 07:22 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0