3
Contributors
7
Replies
8
Views
5 Years
Discussion Span
Last Post by ChrisPadgham
0

You need to write a validation function for that and call the same in the lost focus of the control.

Edited by debasisdas: n/a

0
General declaration
Option Explicit

Private sub cmd_calculate_cllick()

dim radius as double
if IsNumeric(txtR.Text) then
radius=val(txtR.text)
else
  MsgBox("invalid input"
Exit Sub
compute(radius)
End if
Public sub compute(ByVal radius As double)
  dim diameter,circumference as double,area as Double
diameter=...
area=....
circumference=...

end sub

what my teacher want is that the text field of the radius and the diameter would not accept a double data type ...how to ?

Just a beginner all i want is ask some of idea's you experts have

Edited by mike_2000_17: Fixed formatting

0

add this to change event or lost focus of the text box.

if vaL(txtr.text) > 32767 then
msgbox( "out of range")
end if;
0
if (Trim(Like"*[!0-9]*") then

can u explain this to me what this kind of method i dont clearly understand it all i know "Like " is an operator in VB but it use and asteres and parenthesis
MsgBox("not valid")
end if
this method i use do work but...i forgot to trap, if the user will input greater than 32767 it has an error...i think ur method do work

I'm just a beginner please be patience if sometimes it hard for me to understanf right away

Edited by Nick Evan: Removed all the horrible tags

1

if you only want an integer

if isnumeric(txtr.text) then
   if int(txtr.text)=val(txtr.text) then
     OK
   else
     msgbox "Only integers please"
     exit sub
   end if
else
   msgbox "Please enter a number"
   exit sub
end if

Edited by ChrisPadgham: n/a

Votes + Comments
Useful
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.