Why does the caption keep coming up 0?
Sub SetPos()
PC.xpos = 0
PC.xview = 120
PC.ypos = 0
PC.yview = 120
frmGame.Caption = PC.yview
End Sub
Printable View
Why does the caption keep coming up 0?
Sub SetPos()
PC.xpos = 0
PC.xview = 120
PC.ypos = 0
PC.yview = 120
frmGame.Caption = PC.yview
End Sub
You can surely say this function should work. So search your code for "Caption =" maybe you set the caption somewhere else, too.
I got it to work, but not how I like...
In module 1 -
Type PlayerChar
xpos As Integer
ypos As Integer
xview As Integer
yview As Integer
xvel As Integer
yvel As Integer
End Type
Global PC As PlayerChar
In module 2, I set the properties in that sub. But it doesnt work... how do I make it so that it still works even if they are in different modules?
There's nothing to do.. it should work. If you declared that variable in a public module you can access them from any other module or class... so there should be no problem.
Throw a CStr in there. Indirect conversion assignments are bad.
That already worked, Janus.
I know it worked, but he should still do explicit conversions nonetheless. It's good coding practice :P
Yeah VB gives us some really bad coding habits. I'm having a hard time getting used to C++ because of that :p
Drakon, can you please post the code? There doesn't seem to be any problem with the part you're showing us, I'm sure it's somewhere else.