| From: Orphetter | E-mail: DrPepperPop@aol.com | 1 |
Date: Monday, May 21, 2001 at 23:48:15
Subject: Need help
Comments:
I'm new to vb6.0. And i am having a hard time trying to learn the variables and stuff. I have to code the square root button so it calculates and displays the square root of a whole number. I have to assign the numeric equivalent of the txtNumber.text property to an integer variable. And i have to assign the square root to a single variable. Can you help please?
| From: Martin Allen | E-mail: <No e-mail> | 2 |
Date: Monday, May 28, 2001 at 00:57:05
Subject: RE: Need help
Comments:
If the integer variable was called 'i' then you could probably use this code:
| i = Sqr(txtNumber.Text) |
You would have to make sure that the txtNumber.Text had a valid number or you could error handling in the procedure.
| From: Chris | E-mail: chris_789@hotmail.com | 3 |
Date: Tuesday, June 12, 2001 at 04:39:21
Website: none
Subject: RE: Need help
Comments:
What you have Martin is good but it brings possible erros - try this
Dim i as
integer
Dim IsNumber as boolean
IsNumber = isNumeric(txtNumber.text)
if IsNumber = false then
i = msgbox("Please enter a number into the
textbox!",vbokonly,"Number Error")
exit sub
end if
i = txtNumber.text
i = Sqr(i)
lblAnswer.caption = i
'This code is better because is prevents the error by
finding it and telling the user
| From: Martin Allen | E-mail: <No e-mail> | 4 |
Date: Monday, June 18, 2001 at 18:25:36
Subject: RE: Need help
Comments:
You are right Chris, but I did suggest this.
This forum is no longer taking new messages or replies since 01 November 2002. The above material is for reference purposes only.
The new Visual Basic 6.0 forum can be found here.