We can write a VB2015 to generate generate a geometric progression based on the following formula:
the nth term of a GP is ar^n-1, where a is the first term, r the common ratio and n is the number of terms.
To create the code, we insert the following controls:
List Box- to display the output
textbox 1 – to let user input the first number
textbox 2 – to let user input the common ratio
textbox3 – to let user input the number of terms.
We use the syntax
to add the numbers generated to the list box
And we use the do loop to generate the numbers.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim n, num As Integer
Dim x, r As Single
x = Txt_FirstNum.Text
r = Txt_CR.Text
num = Txt_terms.Text
ListBox1.Items.Add(“n” & vbTab & “x”)
n = 1
ListBox1.Items.Add(n & vbTab & x)
x = x * r
n = n + 1
ListBox1.Items.Add(n & vbTab & Format(x, “0.00”))
Loop Until n = num + 1
The Design Interface
After creating a database in Visual Basic 6. we can write code to allow the user to to search for a certain information using SQL query. SQL stands for Structures Query Language. Using SQL keywords, we are able to select specific information to be displayed based on certain criteria. The syntax of a SQL is as follows:
SELECT fieldname1,fieldname2,…..,fieldnameN FROM TableName
SELECT * FROM TableNam
Learn more about SQL from the link below:
If you have a mini library at home or you are in charged of building a database for a library, you can build a simple library system using Visual Basic 6. This library allows the user to search for a book using filters like authors. Follow the link below to learn more about the program.
You can create a prime number tester in VB6 easily. This program can test whether a number entered by the user is a prime number or not.
A prime number is a number that cannot be divided by other numbers other than by itself. Examples are 2, 3, 5, 7, 11, 13,17,19, 23,29, 31, 37 and more. – See more at: http://www.vbtutor.net/VB_Sample/Prime.htm#sthash.AmIybwCv.dpuf
You can create many practical Visual Basic applications in solving secondary school mathematics. Among them is simultaneous equations. You can create Visual Basic applications to solve linear simultaneous equations and non-linear simultaneous equations. Simultaneous equations are equations that involves two or more unknown variables. There must be as many equations as the number of unknown variables in order for us to solve the problem.
We have written two simultaneous equations solver using Visual Basic 6, one is linear and the other one is non-linear. learn more by following the links below: