Skip to content

Visual Basic Samples

Peter Foot edited this page Apr 4, 2017 · 1 revision

Visual Basic Samples

The samples here are provided in VisualBasic.NET. C# users are generally always able to read VB except in the most advanced cases. Apart from obvious like needing semicolons added, method calls and member access for example are very similar, and explicit Sub…End Sub, While … End While can simply be replaced by braces {…}. For the samples here the only thing that might need to be explained is that “Dim” creates a variable definition, so the first two lines in the first OBEX sample in VB and C# are:

Dim addr As String = "112233445566"
Dim uri As New Uri("obex://" & addr & "/HelloWorld.txt")

and

String addr = "112233445566";
Uri uri = new Uri("obex://" + addr + "/HelloWorld.txt");

So apart from the change to the variable definition syntax we needed to add a semicolon to end of each line, change the case of keyword “New” to be “new”, and change VB’s string append operator (&) to C#s ‘+’ equivalent.

Clone this wiki locally