Home > Software engineering >  How to define a global array, and then the key events such as the function of assignment on it?
How to define a global array, and then the key events such as the function of assignment on it?

Time:11-01

(within the same form), to define a global array, and then in the event of button on some of its elements assignment
Such as defined in the standard module
Public date_data1 (1 To 32) As Byte 'date, time, temperature and humidity parameter storage array 1
And then to change some of its value in the commad function
Private Sub Cad_auto_show_Click ()
Date_date1 (1)=1 'send data to a global array, intelligent, showing
End Sub
Running, click the button, you will be prompted "subroutine or function is undefined"
Private Sub Cad_auto_show_Click () turn yellow

CodePudding user response:

Date_date1 (1)
Date_data1 (1)
Variable names you are mistaken, typo so wrong

CodePudding user response:

A public class, you'll have to do is *. CLS file names such as: data structure
There are four variables
Public Date As the Date
Public time As the Date
The Public As a Double temperature
Public humidity As Double

Of such a structure

2, the module a1. Bas
Public data structure (32) As the New array data structure

3, frm1 FRM form

Private Sub Command1_Click ()
Array data structure (1). The date=Now
Array data structure (1). Time="11:51
"Array data structure (1). Humidity=3.5
Array data structure (1). The temperature=35


End Sub
  • Related