Ludootje
02-01-2004, 10:23 AM
I've got this code in frmSettings:
Private Sub Form_Load()
txt_settings_stats.Text = var_nr_stats
txt_settings_rnd1.Text = var_rnd_x
txt_settings_rnd2.Text = var_rnd_y
End Sub
When I want to open the settings form, VB6 tells me this:
Compile error:
Variable not defined
After I hit 'Ok' it leads me to the code it has a problem with, and in this case it highlights the "Private Sub Form_Load()" in yellow, puts a => before it; and also selects var_nr_stats
The variable is defined like this in frmMain's General Declarations:
Option Explicit
Public var_rnd_x As Integer
Public var_rnd_y As Integer
Public var_nr_stats As Integer
Then the variables are set here:
Private Sub Form_Load()
var_rnd_x = 1
var_rnd_y = 10
var_nr_stats = 5
frmMain.lbl_values.Caption = "The number is between " & var_rnd_x & ", " & var_rnd_y & "."
Call start_newgame
End Sub
The variables are public, so why doesn't this work?
(BTW 'defined' does mean that there's no such variable right, not that they have no value?)
Thanks!
Private Sub Form_Load()
txt_settings_stats.Text = var_nr_stats
txt_settings_rnd1.Text = var_rnd_x
txt_settings_rnd2.Text = var_rnd_y
End Sub
When I want to open the settings form, VB6 tells me this:
Compile error:
Variable not defined
After I hit 'Ok' it leads me to the code it has a problem with, and in this case it highlights the "Private Sub Form_Load()" in yellow, puts a => before it; and also selects var_nr_stats
The variable is defined like this in frmMain's General Declarations:
Option Explicit
Public var_rnd_x As Integer
Public var_rnd_y As Integer
Public var_nr_stats As Integer
Then the variables are set here:
Private Sub Form_Load()
var_rnd_x = 1
var_rnd_y = 10
var_nr_stats = 5
frmMain.lbl_values.Caption = "The number is between " & var_rnd_x & ", " & var_rnd_y & "."
Call start_newgame
End Sub
The variables are public, so why doesn't this work?
(BTW 'defined' does mean that there's no such variable right, not that they have no value?)
Thanks!