Skip to content

Instantly share code, notes, and snippets.

@facebookegypt
Created February 27, 2013 20:14
Show Gist options
  • Save facebookegypt/5051288 to your computer and use it in GitHub Desktop.
Save facebookegypt/5051288 to your computer and use it in GitHub Desktop.
Option Explicit
'API to move windowless form
Private Const HTCAPTION As Long = 2
Private Const WM_NCLBUTTONDOWN As Long = &HA1
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Dim P, PV, ARP, ARP1, R, N As Double
Private Sub Command1_Click()
'P=(Pv*R) / [1 - (1 + R)^(-n)]
PV = Val(TxtLoan.Text)
N = Val(Txtmonths.Text)
R = Val(TxtInterest / 100) * (1 / 12)
ARP = Val(1 + R) ^ N
ARP1 = Val(R) / (ARP - 1)
P = Val(R + ARP1) * PV
TxtMp.Text = Format(P, "#.00")
End Sub
Private Sub Command1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then End
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then End
End Sub
Private Sub Form_Load()
DTC.Value = Now
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Moving the form using mouse button from any location on the form held with mouse
If Button = 1 Then
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&
End If
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&
End If
End Sub
Private Sub Label10_Click()
Set MainFrm = Nothing
End
End Sub
Private Sub Label12_Click()
Me.WindowState = vbMinimized
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Format(Now, "DDDD, D/MMMM/YYYY")
Label2.Caption = Format(Now, "HH:MM:SS")
End Sub
Private Sub TxtLoan_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then End
End Sub
Private Sub Txtyears_Change()
Txtmonths.Text = Val(Txtyears.Text) * 12
End Sub
Private Sub Txtyears_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then End
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment