Archive

Archive for January 5, 2009

Parse Integer variable and get hash code from Integer

January 5, 2009 programmervb Leave a comment

public class Test
public Shared Sub Main
Dim Number As String
Number = “4″
Console.WriteLine(Integer.Parse(Number))
Console.WriteLine(Number.GetHashCode())

End Sub
End class

Categories: VBNet

Integer boolean calculation: Or, And, Xor, Not

January 5, 2009 programmervb Leave a comment

public class Test
public Shared Sub Main
Dim I As Integer

I = 3 Or 4
Console.WriteLine(I)

I = 2 And 4
Console.WriteLine(I)

I = 3 Xor 3
Console.WriteLine(I)

I = Not 5
Console.WriteLine(I)
End Sub
End class

Categories: VBNet Tags:

Integer.GetType

January 5, 2009 programmervb Leave a comment

Module Module1

Const x As String = “This is a string”

Sub Main()
Dim a As Double = 5.678
Dim b As Int32 = 123

Console.WriteLine(a.ToString)
Console.WriteLine(b.ToString)
Console.WriteLine(456.987.ToString)

Dim c As Integer
Console.WriteLine(c.GetType())
Console.WriteLine(c.GetType().ToString)

End Sub

End Module

Parse Integer

January 5, 2009 programmervb Leave a comment

public class Test
public Shared Sub Main
Try
Dim num_items As Integer = Integer.Parse(“123″)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End class