順便貼作業
抓按鈕
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Button1.Left = Rnd() * (Me.ClientRectangle.Width - Button1.ClientRectangle.Width)
Button1.Top = Rnd() * (Me.ClientRectangle.Height - Button1.ClientRectangle.Height)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = False
Button1.Text = "被抓到了"
End Sub
End Class
如上
簡單至極 程式放在xuite網硬中 昇級版 Public Class Form1 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Button1.Left = Rnd() * (Me.ClientRectangle.Width - Button1.ClientRectangle.Width) Button1.Top = Rnd() * (Me.ClientRectangle.Height - Button1.ClientRectangle.Height) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Button1.Text = "來抓我ㄚ" Then Timer1.Enabled = False Button1.Text = "被抓到了" Else Timer1.Enabled = True Button1.Text = "來抓我ㄚ" End If End Sub End Class 
閏平年顯示
Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text Mod 4 <> 0 Or TextBox1.Text Mod 4 = 0 And TextBox1.Text Mod 100 = 0 Then Then
Label2.Text = "平年"
Else
Label2.Text = "閏年"
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("非常無聊的程式不知道能幹嘛")
End Sub
End Class
不知能幹嘛用冏.....

十進位轉二進位
Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Tag = TextBox1.Text
Label3.Text = ""
Do
Label3.Text = Me.Tag Mod 2 & Label3.Text
Me.Tag = Me.Tag \ 2
Loop Until Me.Tag = 0
TextBox1.Focus()
TextBox1.SelectAll()
End Sub
End Class

超囧作業要自己去抓搞屁阿

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
本利和.Text = 本金.Text
年.Text = 0
Do Until 本利和.Text > 幾倍.Text * 本金.Text
年.Text = 年.Text + 1
本利和.Text = 本利和.Text + 利率.Text * 本利和.Text / 100
Loop
本金.Focus()
本金.SelectAll()
'需要一點思考但重要的是 !!!作業居然要自己抓搞什麼嘛'
End Sub
End Class
看質因數
Public Class Form1
Dim a, b As Int64
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 看質因數.Click
a = TextBox1.Text
b = 2
Label1.Text = "1 "
If a = 1 Then
Label1.Text = "1不是質數也不是合數喔"
Else
Do Until (a = 1)
Do Until a Mod b = 0
b = b + 1
Loop
Label1.Text = Label1.Text & "*" & b
a = a / b
Loop
End If
TextBox1.Focus()
TextBox1.SelectAll()
End Sub
End Class
怨恨顯示(沒屁用)
Public Class Form1Dim a, b As Int64
Dim c As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = InputBox("你恨他幾遍阿(輸入次數)")
Do Until b = a
b = b + 1
TextBox1.Text = TextBox1.Text & b & "." & "我好恨喔" & vbCrLf
Loop
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
c = InputBox("你恨誰ㄚ")
Button1.Text = c & "我恨死你了"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("請不要恨他太多次以免跑不出來(這程式其實沒屁用)")
End Sub
End Class

沒有留言:
張貼留言