variables not holding values
hello again,
im transferring a fortran program to VB, and the translator doesnt do great but it does its job. Anyway I have a huge list of public variables, these variables are set right at the beginning of the program (they are specifically set to zero). then the program calls a subroutine and then the subroutine calls another subroutine. When I check the variables some of the variables are coming in as zeros and others (that are set to zero) are coming in "empty".
Is it possible for something in the program to unset them?
Can you set the value of the public variables in the public statements?
Does setting the values in the main program possible effect the way they are transfered to different subroutines since they are public variables?
thanks guys.
Re: variables not holding values
Only variables of the type Variant can be "empty". If the variable is supposed to contain a numeric value its type should reflect that. So they should be declared as Integer or Long for integer valus and Single or Double for floating point values. By declaring the variable of the proper type it will be initilized as 0.
Re: variables not holding values
Quote:
Can you set the value of the public variables in the public statements?
no you would need to to it in a proceedure such as form load
Quote:
Does setting the values in the main program possible effect the way they are transfered to different subroutines since they are public variables?
once set they stay the same in all subs until they are changed or reset
this is for vb6 (vb5 /vba), the forum you have posted in
vb.net i believe you can set the variable in the declaration
Re: variables not holding values
Quote:
Originally Posted by Armageddon85
hello again,
im transferring a fortran program to VB, and the translator doesnt do great but it does its job. Anyway I have a huge list of public variables
sounds to me as if you are declaring variables in a single statement like
Dim var1, var2, var3 as Single
In Fortran they are probably all singles (I have only used Fortran back in 1979!!!), in VB6 only var3 is a single, the others are Variants!!!!
Re: variables not holding values
Have you declared "option explicit" at the beginning just to check you have not misspelt anything? I am no expert but sometimes its the simplest things