Dim x As Integer
Dim n As Integer
Dim i As Integer
Dim Tot As Double
x = val(text1.text)
n = val(Text2.text)
If n <=0 Or x <1 Then
MsgBox "Enter Proper Values"
Exit Sub
End If
Tot = 0
For i = 1 To n
Tot = Tot + (x ^ i)
Next
MsgBox Tot

Once you know the Logic, you can try playing around with the code.. But any way, here is the code:

Dim x As Integer
Dim n As Integer
Dim i As Integer
Dim Tot As Double
x = Val(text1.text)
n = Val(Text2.text)
If n <=0 Or x <1 Then
MsgBox "Enter Proper Values"
Exit Sub
End If
Tot = 0
For i = 1 To n
Tot = Tot + (x ^ i)
Next
For i = 0 To (n +1)
Tot = Tot - (x ^ i)
Next
MsgBox Tot

Dim x, n, i As Integer
Dim Tot As Double
x = Val(Text1.Text)
n = Val(Text2.Text)
If n <= 1 Or x < 0 Then
MsgBox "Enter Proper Values", vbCritical
Exit Sub
End If
Tot = 0
Do While i = 1 - n
Tot = Tot + (x ^ i)
Loop

Dim x, n, i As Integer
Dim Tot As Double
x = Val(Text1.Text)
n = Val(Text2.Text)
If n <= 1 Or x <= 0 Then
MsgBox "Enter Proper Values", vbCritical
Exit Sub
End If
Tot = 0
i = 1
Do While i <= n
Tot = Tot + (x ^ i)
i = i + 1
Loop

wow great thank you so much sir! how about this sir i want to convert it into do while

Dim x As Integer
Dim n As Integer
Dim i As Integer
Dim Tot As Double
x = Val(text1.text)
n = Val(Text2.text)
If n <=0 Or x <1 Then
MsgBox "Enter Proper Values"
Exit Sub
End If
Tot = 0
For i = 1 To n
Tot = Tot + (x ^ i)
Next
For i = 0 To (n +1)
Tot = Tot - (x ^ i)
Next
MsgBox Tot

Dim x As Integer
Dim n As Integer
Dim i As Integer
Dim Tot As Double
x = Val(text1.text)
n = Val(Text2.text)
If n <=0 Or x <1 Then
MsgBox "Enter Proper Values"
Exit Sub
End If
Tot = 0
i = 1
Do While i <= n
Tot = Tot + (x ^ i)
i = i + 1
Loop
i = 0
Do While i <= (n + 1)
Tot = Tot - (x ^ i)
i = i + 1
Loop
MsgBox Tot

I have an assignment to output contents from a .txt file to html. I'm able to output the information from the .txt to the console but how would I output ...

Hello, am working on a program for the U.S. Department of Labor. I am working on two programs for the state of Oregon, and the program that reads data and ...