Private是在窗体模块中定义变量、数据类型或者子过程时使用的,定义的东西只能在本窗体内使用;
Public是在公共模块中定义变量、数据类型或者子过程时使用的,定义的东西可以在整个程序的各个窗体中使用。
譬如:
Private:
(窗体中的公共部分写入)
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
这段内容声明的函数,只能在本窗体中使用。
Public:
(公共模块中写入)
public x as integer
此时,该x可以被各个窗体调用
如果有什么还不明白的话可以问题补充一下,我很乐意解答你的^_^
温馨提示:答案为网友推荐,仅供参考