標籤雲
2014年4月25日 星期五
Maze Sample
2014年4月22日 星期二
Resurive Sample
'' 求1+3+5+ + 99 = ?
'Public Class Form1
' Dim sumN = 0
' Sub sum(sN, eN, stepN)
' '判斷結束否
' If sN > eN Then Return
' '每次過程要做的事
' sumN = sumN + sN
' '往完成工作方向前進
' sum(sN + stepN, eN, stepN)
' End Sub
' Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Call sum(1, 100, 2)
' MsgBox(sumN)
' End Sub
'End Class
' 求1!+2!+3!+ + 10! = ?
'Public Class Form1
' Dim sumN = 0
' Sub sum(sN, eN, stepN)
' '判斷結束否
' If sN > eN Then Return
' '每次過程要做的事
' Dim tsum = 1
' For i = 1 To sN
' tsum = tsum * i
' Next
' sumN = sumN + tsum
' '往完成工作方向前進
' sum(sN + stepN, eN, stepN)
' End Sub
' Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Call sum(1, 5, 1)
' MsgBox(sumN)
' End Sub
'End Class
'尋找最大值
'Public Class Form1
' Dim maxValue = 0
' Dim a() = {10, 200, 100, 50, 30}
' Sub fMax(sN, eN)
' '判斷結束否
' If sN > eN Then Return
' '每次過程要做的事
' If a(sN) > maxValue Then maxValue = a(sN)
' '往完成工作方向前進
' fMax(sN + 1, eN)
' End Sub
' Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Call fMax(0, a.Length - 1)
' MsgBox(maxValue)
' End Sub
'End Class
重覆排列
2014年4月1日 星期二
Kill Process
'Kill process
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub
Sub killProcess(processName)
Dim process1 As Process()
process1 = Process.GetProcessesByName(processName)
For Each proces As Process In process1
proces.Kill()
Next
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
System.Diagnostics.Process.Start("iexplore")
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Call killProcess("iexplore")
Call killProcess("mspaint")
End Sub
End Class