Killsoft Sugdok

Basic Code For Newbie

Go down

Basic Code For Newbie

Post by giovhz on Sat Dec 13, 2014 2:38 pm

HELLO WORLD


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Hello World", "Message Box Title")
End Sub

End Class


VARIABLES


Public Class Form1

Dim messagecontent As String = "Variables are so cool"
Dim mynumber As Integer = 10

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show(mynumber)
End Sub

End Class


IF STATEMENTS




Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "hello" Then
Label1.Text = "world"
End If
End Sub

End Class



PROGRESS BAR SAMPLE




Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Value = ProgressBar1.Value + 20
End Sub

End Class







LISTBOX SAMPLE


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
End Sub

End Class





DO WHILE




Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim num1 As Integer = 1

Do While num1 < 10
MessageBox.Show("The value of num1 is :" & num1)
num1 = num1 + 1
Loop

End Sub

End Class


DO UNTIL


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim num As Integer = 1

Do Until num = 5
MessageBox.Show("The value of num is: " & num)
num = num + 1
Loop

End Sub

End Class

/
[You must be registered and logged in to see this link.]

[You must be registered and logged in to see this link.]
avatar
giovhz
Newbie
Newbie

Posts : 41
Join date : 2013-03-09

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum