|
-
Dec 22nd, 2000, 12:50 PM
#1
What does Loop without Do mean in this context??
Loop While FTemp <> ""
-
Dec 22nd, 2000, 12:55 PM
#2
Fanatic Member
You have to have a do statement at the beginning of your loop and the Loop While statement at the end.
Code:
Do
' your code here
Loop While ftemp <> ""
Looks like a neverending loop to me though, be careful!
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 22nd, 2000, 12:57 PM
#3
Prompt = "Enter a Farenheit temperature."
If FTemp <> "" Then
Celcius = Int((FTemp + 40) * 5 / 9 + 40)
MsgBox (Celsius), , "Temperature in Celcius"
End If
Loop While FTemp <> ""
This is the code I have, the book has the code that way, aaarrrggghhh!
-
Dec 22nd, 2000, 01:04 PM
#4
eeeessh!
What book is that!???
is there more to that code? that wont work at all!
Code:
'there is no use for prompt...like an InputBox
'there is no DO for this loop!
Prompt = "Enter a Farenheit temperature." 'Ok...but where do I enter it!!! :)
If FTemp <> "" Then
Celcius = Int((FTemp + 40) * 5 / 9 + 40)
MsgBox (Celsius), , "Temperature in Celcius"
End If
Loop While FTemp <> ""
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Dec 22nd, 2000, 01:09 PM
#5
Fanatic Member
Try This instead..
Code:
Do
Prompt = "Enter a Farenheit temperature."
FTemp = InputBox(Prompt)
If FTemp <> "" Then
Celcius = (Int(FTemp) + 40) * 5 / 9 + 40
MsgBox Str(Celcius), , "Temperature in Celcius"
End If
Loop While FTemp <> ""
If that is how the code is in the book, find the closest source of fire and burn it!
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 22nd, 2000, 01:11 PM
#6
PowerPoster
I'm sure you're lost the Do in somewhere else. 'coz loop will not be able to work if Do syntax is not there.
Chris
-
Dec 22nd, 2000, 01:14 PM
#7
Geoff,
This is the VB 6 book by Microsoft... Michael Halvorson
Talk about annoying the amount of errors and here I am, sorta getting the hang of it and then I get totally floored by something that makes no sense at all!
I'll try your suggestion and thanks!
-
Dec 22nd, 2000, 01:20 PM
#8
_______
<?>
Code:
Private Sub Command1_Click()
Dim prompt As String
prompt = "Enter a Farenheit temperature."
FTemp = InputBox(prompt, "Temp")
If FTemp = "" Then
Exit Sub
Else
'where this came from who could guess
'this gives 32 R as 80 c when in fact it is 0
Celcius = Int((FTemp + 40) * 5 / 9 + 40)
'I don't know the exact formula its -32/.something
MsgBox FTemp & " Farenheit = " & Celcius & " Temperature in Celcius"
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Dec 22nd, 2000, 01:33 PM
#9
formula!
I hadn't noticed the formula is wrong! Excelent work Microsoft!
Code:
Celcius = Int((FTemp + 40) * 5 / 9 + 40)
should be
Code:
Celcius = Int((FTemp -32) * 5 /9)

Code:
Fahrenheit = Int((FTemp *9 /5)+32)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|