大侠们,快来救我一把(如何在一个过程中调用另一个过程中的参数)
关于vb:大侠们,快来救我一把(如何在一个过程中调用另一个过程中的参数)如何在一个过程中调用另一个过程中的参数 比如: Private Sub Command1_Click() dim p as integer 'p局部变量 p=...... End Sub ------------- Private Sub Timer3_Timer() Dim x As Integer x = Val(Text2.Text) / 10 If Shape4.Left < 7025 Then Shape4.Left = Shape4.Left + x*p 'p是另一个过程中的参数 Shape4.Top = Shape4.Top - x*p Else Shape4.Left = Shape4.Left + x End If End Sub 想在Timer3_Timer() 中调用Command1_Click() 中的p
1。如果Command1和Timer3处在同一窗体,则需在窗体声明初定义变量p。当Timer3_Timer事件作用时会得到p的值。 2。如果Command1和Timer3处在不同窗体,可把Command1_Click事件中变量p赋值给该Command1所在窗体的文本框控件或标签控件。
在Timer3_Timer事件代码中改为: Private Sub Timer3_Timer() Dim x As Integer x = Val(Text2。Text) / 10 If Shape4。Left < 7025 Then Shape4。
Left = Shape4。Left + x * Val(Text1。Text) 'p是另一个过程中的参数 Shape4。Top = Shape4。Top - x * Val(Text1。Text) Else Shape4。Left = Shape4。
Left + x End If End Sub 也可如楼上所说,在公共标准模块中或窗体声明处用Public定义变量p。 。
把p声明为全局变量 或者把p的值作为timer的参数
答:Shell 只能调用可执行文件。函数声明:Private Declare Function ShellExecute Lib "shell32.dll" Ali...详情>>
答:详情>>