• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Sunday, June 10, 2012

VISUAL BASIC 6 - TUTORIAL FOR NEWBIE (CASE)


Hi... Now You at Site WE ARE KNOWLEDGE... Having Knowledge in here... Let's Read it...

This time I want giving you tutorial about conditional VISUAL BASIC 6 is "CASE"
I make program of "MOON"
If you input Number 1 until 12 moon name want to appear

First open VISUAL BASIC 6 program...

And make like this
You can use facility "TOOLBOX"



You can change name in PROPERTIES "CAPTOIN"

Then you must input program code with method :

click menu view >> code..

OR

Double Click in text1, text 2 or command1...

And you can COPY This program and PASTE in CODE..


Private Sub Command1_Click()
Dim sBulan As String
Select Case Val(Text1.Text)
Case Is < 1
sBulan = "Wrong"
Case 1
sBulan = "January"
Case 2
sBulan = "February"
Case 3
sBulan = "March"
Case 4
sBulan = "April"
Case 5
sBulan = "May"
Case 6
sBulan = "June"
Case 7
sBulan = "July"
Case 8
sBulan = "August"
Case 9
sBulan = "September"
Case 10
sBulan = "October"
Case 11
sBulan = "November"
Case 12
sBulan = "December"
Case Is > 12
sBulan = "Wrong"
End Select
Text2.Text = sBulan
End Sub

And Result:

And if done..
you can execution this program...


Click Knop play or press "F5"


The first I input Number 4 and  result is "APRIL"




The first I input Number 9and  result is "SEPTEMBER"



The first I input Number 12 and  result is "DECEMBER"


And if you input number > 12 or < 1 result is "WRONG"... If you not beliave.. Make This program And Trying...






Ok.. Just it...


Thanks For you...

Don't forget... Came back to my Site....




No comments:

Post a Comment