Creating a program in VB2015 that generates geometric progression

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

ListBox1.Items.Add(x)

to add the numbers generated to the list box

And we use the do loop to generate the numbers.

The Code

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
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”)
ListBox1.Items.Add(“___________”)

n = 1
ListBox1.Items.Add(n & vbTab & x)
Do
x = x * r

n = n + 1
ListBox1.Items.Add(n & vbTab & Format(x, “0.00”))
Loop Until n = num + 1
End Sub

End Class

The Design Interface

gp_2015

The Output

GP2

TwitterShare/Bookmark

Using SQL Queries in Visual Basic 6

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:

http://www.vbtutor.net/lesson27.html

Creating a Prime Number Tester in VB6

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

Creating a Simultaneous Equations Solver in Visual Basic 6

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:

http://www.vbtutor.net/VB_Sample/simuleq.htm
http://www.vbtutor.net/VB_Sample/simuleq2.htm