# Visual Basic > Visual Basic FAQs >  Classic VB - Why shouldn't I use "Dim .. As New .."?

## si_the_geek

While using "Dim .. as New .." saves you 1 line of code, it adds problems that are best avoided.

First of all it makes your code slower, as the variable is not created immediately - instead _every_ time you use that variable VB checks if it has been Set yet, and if not it gets Set.

The speed issue is not often a major problem, but the other issues are.  As the variable will get Set any time it is used, you can easily (accidentally) Set the object again after you have unloaded it, so it remains in memory.  Not only is the memory wasted, but the chances are that your code isn't doing what you intended it to do - but you wont be told why, as there will be no error to say the object isn't Set (and will probably only notice if it does something that is blatantly wrong, which isn't always the case).

Instead of using a single line "Dim _variable_ as New _DataType_", you should use a separate Dim and Set lines like this:


```
'no "New"!  this specifies the data type of the variable, and reserves the memory for it
Dim variable as DataType
'this creates a new instance of the object, and places it into the variable
  Set variable = New DataType
```

When you have finished with it, unload it (and release the memory that was used) by setting it to Nothing:


```
  Set variable = Nothing
```

----------

