Look at this code...
VB Code:
'This code will put a random floating point between 0 and 1 in 'the Random property of the member object. For i = 0 To Group.Count - 1 Randomize() Dim dbl As Double = ((1 * Rnd()) + 0) MsgBox(dbl.ToString) Group.Members(i).Random = dbl MsgBox(Group.Members(i).Random.ToString) Next i 'Sanity Check!!! Read the values back in a message box! Dim strTemp As String = "" For i = 0 To Group.Count - 1 strTemp &= Group.Members(i).Random.ToString & vbCrLf Next i MsgBox(strTemp)
Ahem... Am I going insane, or is there something really wrong with this code?
It seems to me that the values are being put into the object correctly, but when I read it back I get the same floating point back for all of the *different* values...
for instance,
i will get something like the following for the two message boxes in the first loop... I know the numbers aren't right, but u'll get the idea...
.1
.1
.2
.2
.3
.3
.4
.4
and in the last message box i get
.4
.4
.4
.4
What's going on here???
Thanks,
Squirrelly1




Life is grand for a coder, no?
Reply With Quote