Thread Solved

Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Please Help!

 
0
  #1
Dec 16th, 2008
can anyone change this for next statement to do while statement?

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
For i = 1 To n
Tot = Tot + (x ^ i)
Next

Label1.Caption = Tot
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 304
Reputation: aktharshaik is an unknown quantity at this point 
Solved Threads: 37
aktharshaik's Avatar
aktharshaik aktharshaik is offline Offline
Posting Whiz

Re: Please Help!

 
0
  #2
Dec 16th, 2008
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim x, n, i As Integer
  2. Dim Tot As Double
  3.  
  4. x = Val(Text1.Text)
  5. n = Val(Text2.Text)
  6. If n <= 1 Or x <= 0 Then
  7. MsgBox "Enter Proper Values", vbCritical
  8. Exit Sub
  9. End If
  10.  
  11. Tot = 0
  12. i = 1
  13. Do While i <= n
  14. Tot = Tot + (x ^ i)
  15. i = i + 1
  16. Loop
Regards
Shaik Akthar
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC