Friday, September 8, 2017

ການນຳໃຊ້ Select Case (VB6 Lesson 8)

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

Subscribe

  • RSS Atom

ອອນລາຍ: 1 | ມື້ນີ້: 13 | ວານນີ້: 25 | ທິດນີ້: 93 | ເດືອນນີ້: 872 | ປີນີ້: 11832 | ລວມ: 78935