PDA

View Full Version : Solved: Dimming Intergers and Doubles



petedw
10-13-2005, 05:04 AM
Is there a way to Dim something as a integer and then use that along side something else and Dim it as a double.

For example;

Dim iNum As Integer
iNum = 1

Dim reading(iNum) As Double

I know this doesn't work, but is there any way of getting it to? How do i re-write the code??

Many Thanks

Pete

TonyJollans
10-13-2005, 06:07 AM
Hi Pete,

Not quite sure what you're trying to achieve here.

An array of doubles might do the trick (if you have a consecutive series of inums ...Dim iNum as integer
dim reading(1 to 20) as double ' perhaps
iNum = 1
readng(inum) = 123456789

Or, perhaps a user-defined typeType PeteStuff
iNum As Integer
Reading As Double
End Type
Sub Something()
Dim Stuff As PeteStuff
Stuff.iNum = 1
Stuff.Reading = 123456789
' rest of code
End Sub

petedw
10-13-2005, 06:19 AM
Cheers Tony, i'll give that a go