Thursday, September 14, 2017
ໃນບົດຮຽນນີ້ ເຮົາຈະແນະນຳການໃຊ້ String Manipulation Functions ເຊັ່ນ: Len, Right, Left, Mid, Trim, Ltrim, Rtrim, Ucase, Lcase, Instr, Val, Str ,Chr and Asc.
1. The Len Function
ເປັນການນັບເອົາລວງຍາວ ຫລື ຈຳນວນອັກສອນ ຕ່າງໆ
syntax:
Len (“Phrase”)
ຕົວຢ່າງ:
Len (VisualBasic) = 11 ແລະ Len (welcome to VB tutorial) = 22
2. The Right Function
ເປັນການເອົາຂໍ້ມູນອອກຈາກເບື້ອງຂວາ ໂດຍລະບຸ ຕຳແຫນ່ງທີ່ຕ້ອງການ
syntax:
Right (“Phrase”, n)
ຕົວຢ່າງ:
Right(“Visual Basic”, 4) = asic
3. The Left Function
ເປັນການເອົາຂໍ້ມູນອອກຈາກເບື້ອງຊ້າຍ ໂດຍລະບຸ ຕຳແຫນ່ງທີ່ຕ້ອງການ
syntax:
Left(“Phrase”, n)
ຕົວຢ່າງ:
Left (“Visual Basic”, 4) = Visu
[Read more…]
Wednesday, September 13, 2017
ໂປຣແກຣມ ແປງຈາກ Bin ເປັນ Hex ແລະ ຍັງສາມາດແປງ ຈາກ Hex ມາເປັນ Bin ຄືນໄດ້
Image does not exist: https://image.ibb.co/bFmk8a/bin2hex.png
ໂຄ້ດຂອງໂປຣແກຣມນີ້
[Read more…]
Tuesday, September 12, 2017
ໃນ Visual Basic 6 ມີ Built-in Functions , Funcrion ແມ່ນມີຄ້າຍຄື procedure ຈຸດປະສົງຫລັກຂອງ Function ແມ່ນ ຮັບຂໍ້ມູນຈາກ ຜູ້ໃຊ້ ແລະ ຄືນຄ່ານັ້ນອອກມາ
ໃນ Visual Basic 6 ມີ Built-in Functions ມີ 2 ແບບ
syntax:
FunctionName (arguments)
guments ເປັນຄ່າທີ່ ປ້ອນໃສ່ ແລະ ຜ່ານ Funcrion
ໃນບົດຮຽນນີ້ເຮົາຈະຮຽນສອງ Funcrion ຄື MsgBox( ) ແລະ InputBox ( )
1. MsgBox ( ) Function
ຮູບແບບໂຄ້ດ
yourMsg=MsgBox(Prompt, Style Value, Title)
ຄ່າຂອງ Style Value:
Image does not exist: https://image.ibb.co/gQyApF/Style_Values.png
ຕົວຢ່າງ:
yourMsg=MsgBox( "Click OK to Proceed", 1, "Startup Menu")
and yourMsg=Msg("Click OK to Proceed". vbOkCancel,"Startup Menu")
yourMsg ແມ່ນຕົວປ່ຽນທີ່ຮັບຄ່າມາຈາກ MsgBox Function ຊື່ງຄ່າທີ່ໄດ້ຮັບມີຫລາຍຄ່າດັ່ງລຸ່ມນີ້
[Read more…]
Monday, September 11, 2017
ໃນ ພາສາ Visual Basic 6 ມີຮູບແບບການ Loop ຢູ່ 5 ແບບ
1. ແບບ Do Loop
ແບບ Do Loop statements ມີ 4 ແບບ ທີ່ຕ່າງກັນກັນ:
a)
Do While condition
Block of one or more VB statements
Loop
b)
Do
Block of one or more VB statements
Loop While condition
c)
Do Until condition
Block of one or more VB statements
Loop
d)
Do
Block of one or more VB statements
Loop Until condition
[Read more…]
Friday, September 8, 2017
Select Case ຄືການຄວບຄຸມ ຂອງເງືອນໄຂ ຄືກັນກັບ if else then ແຕ່ ມັນຈະໃຊ້ງ່າຍກວ່າ ຊຶ່ງມີ syntax ຂອງ Select Case ດັ່ງລຸ່ມນີ້
Select Case expression
Case value1
Block of one or more VB statements
Case value2
Block of one or more VB Statements
Case Else
Block of one or more VB Statements
End Select
ຕົວຢ່າງ:
Dim grade As String
Private Sub Compute_Click( )
grade=txtgrade.Text
Select Case grade
Case "A"
result.Caption="High Distinction"
Case "A-"
result.Caption="Distinction"
Case "B"
result.Caption="Credit"
Case "C"
result.Caption="Pass"
Case Else
result.Caption="Fail"
End Select
End Sub
Thursday, September 7, 2017
ໃນບົດຮຽນກ່ອນ ພວກເຮົາໄດ້ຮຽນກ່ຽວກັບວິທີການຂຽນໂຄດໃນ Visual basic 6 ແຕ່ໃນບົດນີ້ແມ່ນຮຽນຮູ້ ກ່ຽວກັບ ການນຳໃຊ້ if ແລະ iff() function
1. Conditional Operators
ແມ່ນເຄື່ອງໝາຍສະແດງເຖິງເງື່ອນໄຊໜຶ່ງທີ່ໃຊ້ ໃນ Visual Basic 6
Image does not exist: https://image.ibb.co/hiZceF/vb6_operator.png
2. Logical Operators
ເປັນເງື່ອນໄຂເພີ່ມໃນ Visual Basic 6
Image does not exist: https://image.ibb.co/bZhPRv/Logical_Operators.png
[Read more…]
Friday, September 1, 2017
1. ການກຳນົດຄ່າໃຫ້ຕົວປ່ຽນ
ເມື່ອເຮົາປະກາດຕົວປ່ຽນ ໂດຍໃຊ້ dim ແລ້ວເຮົາສາມາດກຳນົກຄ່າໃຫ້ຕົວປ່ຽນເຫຼົ່ານັ້ນດ້ວຍແບບວິທີດັ່ງນີ້
Variable=Expression
ຕົວຢ່າງ:
firstNumber=100
secondNumber=firstNumber-99
userName="John Lyan"
userpass.Text = password
Label1.Visible = True
Command1.Visible = false
Label4.Caption = textbox1.Text
ThirdNumber = Val(usernum1.Text)
X = (3.14159 / 180) * A
2. Operators ໃນ Visual Basic 6
ປະມວນຄ່າປ້ອນຈາກຜູ້ໃຊ້ ແລະ ໃຫ້ຄຳຕອບແກ້ຜູ້ໃຊ້ ພວກເຮົາໃຊ້ ຕົວປ່ຽນ ທາງຄະນີດສາດດັ່ງນີ້
Image does not exist: https://image.ibb.co/hqhPj5/Arithmetic_Operators.png
ຕົວຢ່າງ 1
Private Sub Command1_Click()
Dim firstName As String
Dim secondName As String
Dim yourName As String
firstName = Text1.Text
secondName = Text2.Text
yourName = secondName +"" + firstName
Label1.Caption = yourName
End Sub
[Read more…]