Page is a not externally linkable
- Hardware and OS Related Technologies
-- Website Technology Issues
---- Working with value passed to an exe


mack - 4:39 am on Nov 28, 2009 (gmt 0)


As I suspected having no value, is not the same as having a value.lenghth = 0

To make it work...

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'get command peramiters
Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
For i As Integer = 0 To CommandLineArgs.Count - 1
Dim myvariable As String
myvariable = (CommandLineArgs(i))
Label1.Text = myvariable.Length 'only used for debug

If myvariable.Length = 0 Then

do something

exit sub
End If
Next

do somethign else

End Sub

by exiting the sub I don't need a second conditional statement, and can run the code that the 2nd if statement would have contained.

Mack.


Thread source:: http://www.webmasterworld.com/website_technology/4033078.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com