目前分類:Visual Basic-實作 (5)
- Oct 16 Mon 2017 15:32
VB_圖書館資訊系統-寫法2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim id$ = "jack"
Dim pw$ = "luck007"
If TextBox1.Text = id And TextBox2.Text = pw Then
MsgBox("歡迎進入圖書資訊系統", , "系統提示")
Else
MsgBox("帳號或密碼輸入錯誤,請重新輸入", , "系統提示")
End If
- Oct 14 Sat 2017 13:21
VB_圖書館資訊系統
- Sep 28 Thu 2017 15:09
Visual Studio
- Sep 26 Tue 2017 21:36
VB函數 春夏秋冬
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim M As Integer
M = Val(TextBox1.Text)
If M <= 3 Then
MsgBox("春天")
ElseIf M <= 6 Then
MsgBox("夏天")
ElseIf M <= 9 Then
MsgBox("秋天")
ElseIf M <= 12 Then
MsgBox("冬天")
Else
MsgBox("無解")
'當我輸入值為1-3時,產生答案為春天
'當我輸入值為4-6時,產生答案為夏天
'當我輸入值為7-9時,產生答案為秋天
'當我輸入值為10-12時,產生答案為冬天
'因為一年只有12個月份,當我輸入值超過13(含)時,產生答案為無解
End If
End Sub
- Sep 20 Wed 2017 08:45
Visual Basic 華氏轉攝氏及攝氏轉華氏數值轉換
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim h, s As Single
h = InputBox("請輸入華氏溫度", "華氏轉攝氏")
s = 5 / 9 * (h - 32)
MsgBox("攝氏溫度為" & s, , "華氏轉攝氏")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim h, s As Single
s = InputBox("請輸入攝氏溫度", "攝氏轉華氏")
h = 9 * s / 5 + 32
MsgBox("華氏溫度為" & h, , "攝氏轉華氏")
End Sub
End Class