Connecting Tech Pros Worldwide Forums | Help | Site Map

Hi need help in debugging

nar nar is offline
Newbie
 
Join Date: Nov 2006
Posts: 1
#1: Nov 20 '06
Hi i am new to VB and am writing a small prog to calculate
some values in a formulae..

for the input i have used a text box so that user inputs
the number
and based on that number is stored as a constant to be used in the formule.
and on clicking a button the out put is shown in another
text box.. i am facing a peculiar problem.. when ever the user types in a number he does not receive the correct
out put unless he enters the input as a decimal

for instance if he enters input as 20 the out put val is wrong and if he enters 20.0 the outputvalue is correct...
i have declared all variables as double where the input and other formulea constants are stored,
pls help..to rectify this

Thanks
nar

sivadhas2006's Avatar
Familiar Sight
 
Join Date: Nov 2006
Posts: 143
#2: Nov 20 '06

re: Hi need help in debugging


Hi,

Can you post your code to find the problem?

Regards,
M.Sivadhas.
Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#3: Nov 20 '06

re: Hi need help in debugging


Quote:

Originally Posted by nar

Hi i am new to VB and am writing a small prog to calculate
some values in a formulae..

for the input i have used a text box so that user inputs
the number
and based on that number is stored as a constant to be used in the formule.
and on clicking a button the out put is shown in another
text box.. i am facing a peculiar problem.. when ever the user types in a number he does not receive the correct
out put unless he enters the input as a decimal

for instance if he enters input as 20 the out put val is wrong and if he enters 20.0 the outputvalue is correct...
i have declared all variables as double where the input and other formulea constants are stored,
pls help..to rectify this

Thanks
nar

Hi. Shooting in the dark without your code here :)
When you take the value from the textbox and assign it to a variable make sure to cast it as a double;
Expand|Select|Wrap|Line Numbers
  1. MyDoubleVariable = CDbl(TextBox1.Text)
  2.  
In the absence of you code, this is the best I can do
Reply