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

hi
this is one of my assignment that I have to do. it is a triangle calculator. everything well with it but it just the calculation. when I run it, ...

Hello everyone hope you are doing well, i was busy these days i was having problem with the police in my country, they catch me smoking weed and now i ...