Code:

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim i As Integer = 512
        Dim s As String = Convert.ToString(i, 2).PadLeft(8, "0"c) '32 bits
        MsgBox(s)
    End Sub
End Class