Saturday, January 31, 2009
Function SumOfNum(ByVal x As Integer) As Integer
Dim i As Integer
SumOfNum = 0
For i = 1 To 100
If i Mod x = 0 Then
SumOfNum = SumOfNum + i
SumOfNum = SumOfNum
Private Sub Command1_Click()
Dim w As Integer
x = Text1.Text
w = SumOfNum(x)
Label1.Caption = w
When you run the program, enter 4 into textbox 1 and you can get the answer. If you key in other numbers, you will get the sum of numbers divisible by that number. Anyone has better solution can email me or write in the comments of this blog.
Thursday, January 29, 2009
Dim Num, n As Integer
Dim I, P, PVIFA, r, pmt, PI, PP As Double
Public Sub Cmd_Calculate_Click()
P = Txt_Principal.Text
Num = Txt_Num_payment.Text
r = Txt_Interest.Text
I = r / 100
PVIFA = 1 / I - 1 / (I * (1 + I) ^ Num)
pmt = P / PVIFA
Lbl_Amtpayment.Caption = Round(pmt, 2)
Private Sub Cmd_Create_Click()
List_Amortization.AddItem "n" & vbTab & "Periodic" & vbTab & vbTab & "Payment" & vbTab & vbTab & "Payment" & vbTab & vbTab & "Balance"
List_Amortization.AddItem "" & vbTab & "Payment" & vbTab & vbTab & "Interest" & vbTab & vbTab & "Principal"
n = n + 1
PI = P * I
PP = pmt - PI
P = P - PP
List_Amortization.AddItem n & vbTab & Round(pmt, 2) & vbTab & vbTab & Round(PI, 2) & vbTab & vbTab & Round(PP, 2) & vbTab & vbTab & Round(P, 2)
If n = Num Then
The sample output screen is shown here:
For detail explanation of the code, please refer to the following link:
Sunday, January 25, 2009
The title is 'Visual Basic 2008 Made Easy- A Concise Guide for Beginners'. It covers all the topics in the VB2008 tutorial. You can print out the book and use it as a guide to learn VB2008.
Be the first one to grab the book!
Friday, January 23, 2009
The other day I received an email from a VB friend who is asking for a printable version of VB2008 tutorial. He is finding it difficult to read the whole tutorial online. I am sure many of you are facing the same problem.
In order to help you learn VB2008 more efficiently and comfortably, I have upgraded the present server to a high end server with faster transfer rate. The web pages are loading must faster now. Please check it out for yourself at vbtutor.net
The next thing is I am writing a VB2008 textbook based on the VB2008 tutorial. I am adding extra stuff than the online version to make it more comprehensive. It is 80% completed now. Once it is completed, I will announce it in the blog and you will be able to download it from our website. By having a text book, I believe it will help you to learn much better.
Tuesday, January 13, 2009
Sunday, January 11, 2009
View the following link for the simple slot machine.
SIMPLE SLOT MACHINE
Sunday, January 4, 2009
Adding menu bar is easily accomplished in Visual Basic. To start adding menu items to your application, open your file and then click on Tools in the menu bar of the Visual Basic IDE, then select Menu Editor. When you click on the Menu Editor, the following window will appear. In the Menu Editor, key in the items such as File, Edit, View and etc. The & sign will be the shortcut to initiate the action under this item by pressing the Alt key and the letter shown after the & sign. The letter will be underlined. Below are the diagrams:
More details will be discussed in future posts.