It's unlikely you'll ever see a difference (you could even see if it doesn't
create the same underlying MSIL code).
This is the same (unlike VB6 were New was checking for existence at each
access to the variable). 2 may be usefull as it allows to create an object
only when (and in particular *if*) you need it which could could save some
time (under unusual circumstances though it's likely best to avoid creating
something if you don't need it).
As a side note it's likely most often considered better to code for clarity
and to work on identified performance problem rather than to be picky about
few microseconds gains... For example if you use a DB it's likely better to
start by looking at indexes design...
Patrice
--
"Paul" <pa*******@smmoving.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP11.phx.gbl...
With respect to performance, is either of these better?
Dim myTextBox As New TextBox
or
Dim myTextBox As TextBox
myTextBox = New TextBox
or
Dim myTextBox As TextBox = New TextBox