当然,也不是非用很多全局变量不可,你可以自己写一个函数:
public iReturn as integer(全局,其实也可以不用,但稍麻烦)
Function ShowDlg(str1 as string,str2 as string) as boolean
dim dlg as form2
set dlg = new form2
dlg.str1=str1
dlg.str2=str2
iReturn = 0
dlg.show vbmodal
if iReturn=1 then
str1=dlg.str1
str2=dlg.str2
ShowDlg=true
else
ShowDlg=false
end if
on error resume next
unload dlg
set dlg=nothing
end function
可以写一个类模块呀!在类模块中声明一个变量如 public strmsg as string
然后给这个类模块命名如clsexzmple
然后在添加一个模块 在模块中声明 exzmple as new clsexzmple
接下来,你就可以在你的程序的任务位置引用这个字符变量了 exzmple.strmsg