Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Apr 6, 2000

Cache Properties for Repeated References

If you have to reference a control's property repeatedly, it's better to assign the property to a temporary variable, then use that variable. This technique is called property caching. For example, if you need to assign text value in the Text1 textbox to all elements in an array named arr, it's better to assign the value to a temporary variable and use it for the assignment in the loop:
 
tmp = Text1.Text
For i = 1 To Ubound(arr)
	arr(i) = tmp 
	' Here use tmp instead of using Text1.Text repeatedly
Next I
Jai Bardhan
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date