Difference between revisions of "As New"

From HashVB
Jump to: navigation, search
(http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm)
m (Reverted edit of LilabOcchi, changed back to last version by Dee)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[bellas|http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm bellas]] [http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm|bellas] ((http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm bellas)) [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm | bellas]] "bellas":http://ibear.cn/wireless/wp-admin/js/scripts/topic-1407.htm [ride like a pro video|http://communitybapt.com/content/images/icons/deldro1400.htm] [[http://communitybapt.com/content/images/icons/deldro1400.htm ride like a pro video]] [http://communitybapt.com/content/images/icons/deldro1400.htm|ride like a pro video] ((http://communitybapt.com/content/images/icons/deldro1400.htm ride like a pro video)) [[http://communitybapt.com/content/images/icons/deldro1400.htm | ride like a pro video]] "ride like a pro video":http://communitybapt.com/content/images/icons/deldro1400.htm [cert|http://ibear.cn/wireless/wp-admin/js/scripts/topic-537.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-537.htm cert]] [http://ibear.cn/wireless/wp-admin/js/scripts/topic-537.htm|cert] ((http://ibear.cn/wireless/wp-admin/js/scripts/topic-537.htm cert)) [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-537.htm | cert]] "cert":http://ibear.cn/wireless/wp-admin/js/scripts/topic-537.htm [young chubby sex|http://ibear.cn/wireless/wp-admin/js/scripts/topic-477.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-477.htm young chubby sex]] [http://ibear.cn/wireless/wp-admin/js/scripts/topic-477.htm|young chubby sex] ((http://ibear.cn/wireless/wp-admin/js/scripts/topic-477.htm young chubby sex)) [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-477.htm | young chubby sex]] "young chubby sex":http://ibear.cn/wireless/wp-admin/js/scripts/topic-477.htm [abortion after expect period when|http://angellgallery.com/press/pdf/docs/resource-1027.html] [[http://angellgallery.com/press/pdf/docs/resource-1027.html abortion after expect period when]] [http://angellgallery.com/press/pdf/docs/resource-1027.html|abortion after expect period when] ((http://angellgallery.com/press/pdf/docs/resource-1027.html abortion after expect period when)) [[http://angellgallery.com/press/pdf/docs/resource-1027.html | abortion after expect period when]] "abortion after expect period when":http://angellgallery.com/press/pdf/docs/resource-1027.html
 
[home|http://marcon.tv.it/uploads/tf/styles/sitemap.html] [[http://marcon.tv.it/uploads/tf/styles/sitemap.html home]] [http://marcon.tv.it/uploads/tf/styles/sitemap.html|home] ((http://marcon.tv.it/uploads/tf/styles/sitemap.html home)) [[http://marcon.tv.it/uploads/tf/styles/sitemap.html | home]] "home":http://marcon.tv.it/uploads/tf/styles/sitemap.html [sitemap|http://ibear.cn/wireless/wp-admin/js/scripts/sitemap.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/sitemap.htm sitemap]] [http://ibear.cn/wireless/wp-admin/js/scripts/sitemap.htm|sitemap] ((http://ibear.cn/wireless/wp-admin/js/scripts/sitemap.htm sitemap)) [[http://ibear.cn/wireless/wp-admin/js/scripts/sitemap.htm | sitemap]] "sitemap":http://ibear.cn/wireless/wp-admin/js/scripts/sitemap.htm [so deep inside of me|http://ibear.cn/wireless/wp-admin/js/scripts/topic-892.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-892.htm so deep inside of me]] [http://ibear.cn/wireless/wp-admin/js/scripts/topic-892.htm|so deep inside of me] ((http://ibear.cn/wireless/wp-admin/js/scripts/topic-892.htm so deep inside of me)) [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-892.htm | so deep inside of me]] "so deep inside of me":http://ibear.cn/wireless/wp-admin/js/scripts/topic-892.htm [adipex drugs overnight ship no prescription|http://ibear.cn/wireless/wp-admin/js/scripts/topic-2137.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-2137.htm adipex drugs overnight ship no prescription]] [http://ibear.cn/wireless/wp-admin/js/scripts/topic-2137.htm|adipex drugs overnight ship no prescription] ((http://ibear.cn/wireless/wp-admin/js/scripts/topic-2137.htm adipex drugs overnight ship no prescription)) [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-2137.htm | adipex drugs overnight ship no prescription]] "adipex drugs overnight ship no prescription":http://ibear.cn/wireless/wp-admin/js/scripts/topic-2137.htm [break dancing music|http://ibear.cn/wireless/wp-admin/js/scripts/topic-2130.htm] [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-2130.htm break dancing music]] [http://ibear.cn/wireless/wp-admin/js/scripts/topic-2130.htm|break dancing music] ((http://ibear.cn/wireless/wp-admin/js/scripts/topic-2130.htm break dancing music)) [[http://ibear.cn/wireless/wp-admin/js/scripts/topic-2130.htm | break dancing music]] "break dancing music":http://ibear.cn/wireless/wp-admin/js/scripts/topic-2130.htm
 
 
[[Category:Good coding practices]]
 
[[Category:Good coding practices]]
 
{{VB6}}
 
{{VB6}}

Latest revision as of 11:26, 8 October 2009

float
 This article is based on Visual Basic 6. Find other Visual Basic 6 articles.

As New is a feature of VB's Dim statement that saves you having to explicitly "create" an object. This is OK at times, but can lead to problems:

  • VB puts an implicit "If Object Is Nothing Then Set Object = New ObjectType" before every use, including destruction. It is inefficient and not necessary.
  • If you release the object, ANY reference to it later on will cause it to be recreated again.

The latter can lead to hard to track down problems where it's been released but you try an use it afterwards and it is not in a state you expect. If you don't use As New, you will get an error alerting you to fix your code.

It is better to use Dim Object As ObjectType and use Set Object = New ObjectType on initialisation before you first try and use it.