Archiv für die Kategorie ‘.NET’

visual basic – error handling

Mai 14, 2006

The error or exception handling in visual basic is quite simple, here an example:

Public Sub doSomething(argument1,argument2)
  On Error GoTo ErrorHandler
    ...
    Exit Sub
  ErrorHandler:
    ...
    Resume Next
End Sub

More infos can be found here (using internet explorer recommended, that this site works properly)

visual basic – regular expression example

April 12, 2006

Output of the following code-snippet would be: robert kleineikenscheidt

Dim re As RegExp
Set re = New RegExp
Dim s As String
re.Pattern = " r.*kleineikenscheidt"
s = "this is robert kleineikenscheidt in biberach"
Dim matches As MatchCollection
Set matches = re.Execute(s)
Dim match As Match
For Each match In matches
    Debug.Print = match.ValueNext
Next

You can find more detailed information and a short reference here.