Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Last active December 27, 2015 01:19
Show Gist options
  • Select an option

  • Save maksadbek/7244394 to your computer and use it in GitHub Desktop.

Select an option

Save maksadbek/7244394 to your computer and use it in GitHub Desktop.
'even & odd
Public Class Form1
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar >= ChrW(Keys.D0) And e.KeyChar <= ChrW(Keys.D9) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub btnOdd_Click(sender As Object, e As EventArgs) Handles btnOdd.Click
Dim result As Long = 0
For i As Integer = 2 To 1000 Step 2
result = result + i
Next
MsgBox(result)
End Sub
End Class
'
Public Class Form1
Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
Dim amount As Double = nudAmount.Value
Dim rate As Double = nudRate.Value
Dim years As Integer = nudYears.Value
Dim balance As Double = amount
For i As Integer = 1 To years
Dim interest As Double = balance * rate / 100
balance += interest
Next
balance = Math.Round(balance)
MsgBox(balance)
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment