Home All Groups Group Topic Archive Search About

Does it make a diff if dims are in an If..then?

Author
13 Nov 2007 10:08 PM
Blackberry
Hi All

I've used a bit of code for a while where I do the following:

Private Sub lsImports_ItemClick(ByVal Item As MSComctlLib.ListItem)

lsvImport.ListItems.Clear

If lsvImports.ListItems.Count > 0 Then

  Dim oXML As DOMDocument, oPupilLst As IXMLDOMNodeList, oPupil As
IXMLDOMNode, oItem As IXMLDOMNode
  Dim oListItem As ListItem, arrPupilData() As String
  Dim intFieldsFoundChk As Integer, lngPupilID As Long

  Set oXML = New DOMDocument
  oXML.async = False

etc .. etc.

In my little brain I thought I would be saving resources by only dim-ing the
above if the If...then is greater than 0.  Am I correct or are the dims
looked at before any logic routines?

Should I simply put my dims at the top (ie underneath the Private Sub line)
so they read correctly?

Thks

AddThis Social Bookmark Button