Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I write !=null in vb .net? 1

Status
Not open for further replies.

Programming2007

Programmer
Nov 10, 2006
24
US
This is my code:
Private Sub getWebViewFiles(ByVal s As String)
Dim files As String()
Dim curDirectory As String()
Dim dirs As String()
curDirectory = Directory.GetFiles("C:\\SCoutline4")
dirs = System.IO.Directory.GetDirectories("C:\\SCoutline4")
Do Until (dirs.Length Is Not Null And curDirectory.Length is not null)
files = Directory.GetFiles(curDirectory & "*.htm")
Loop
End Sub

I tried changing the do until line to: ............Do until(dirs.Length != null) .............
But that doesn't work either. Can't really find the correct syntax for writing these types of expressions on the web. I usually write in C# but I have to write this in vb.net
 
Depends on the version.

In 2005 you can do:
Code:
var IsNot Nothing

However, in previous version you would use:
Code:
Not var Is Nothing
 
Also you don't need to escape the \ in VB so:

[tt]Directory.GetFiles("C:\SCoutline4")[/tt] will work.


Additionally:

you could replace the test for Not Null with [tt]> 0[/tt]

Hope this helps.




[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top