****************传参数的问题,高手指点一下,先谢了********************** 在vba编程中,在from1上有一个multipage控件,它有多个page,但每个page上面都有一个combobox控件和一个listbox控件,combobox控件中加载表信息,每选择一个表,listbox中加载对应表的字段信息,因为多个page的操作类似,我能不能把这些操作抽出来,写成一个方法,这个方法如何写?参数如何传?能不能把listbox的名字作为参数传入?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如说我想几个页面上的 combobox加载相同的数据,我定义一个函数:Private Sub lstLoadTable(ByRef controlName As ComboBox) Dim cnt As Integer Dim i As Integer cnt = UBound(g_selected_tables) If cnt > 0 Then For i = 0 To cnt controlName.AddItem (g_selected_tables(i)) Next End If End Sub加载的时候我直接传一个comboBox进去 lstLoadTable (combobox1) lstLoadTable (combobox2) lstLoadTable (combobox3)我这样做,系统出错,提示说:object required,为什么不能这样? 谁解释一下? call lstLoadTable (combobox1)call lstLoadTable (combobox2)call lstLoadTable (combobox3)或者lstLoadTable combobox1lstLoadTable combobox2lstLoadTable combobox3 楼上的兄弟,还是不行,错误信息如下:Compole error: Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound function. 请高手帮忙解决查询语句问题 VB中的DIR函数的使用 VC制作的MFC OCX控件,在VB中引用,制作VB安装程序,如何把OCX控件正确的打包进去? picturebox.width 的最大值如何可以超过2.45745e5? 把分全部给你,要 RMB 也行,豁出去了。 DataArrival函数中数据丢失问题 用VB开发的MTS组件,移到另一台Server上不能直接用,需要重新编译!Why? 一个不能回家的问题 Printer的问题 求教各位大神,急,在线等!谢谢 恳请帮忙:怎样才能在"非零元素位置"框中显示非零元素?(见内容) DB开发
Private Sub lstLoadTable(ByRef controlName As ComboBox)
Dim cnt As Integer
Dim i As Integer
cnt = UBound(g_selected_tables)
If cnt > 0 Then
For i = 0 To cnt
controlName.AddItem (g_selected_tables(i))
Next
End If
End Sub加载的时候我直接传一个comboBox进去 lstLoadTable (combobox1)
lstLoadTable (combobox2)
lstLoadTable (combobox3)我这样做,系统出错,提示说:object required,为什么不能这样?
谁解释一下?
call lstLoadTable (combobox2)
call lstLoadTable (combobox3)
或者
lstLoadTable combobox1
lstLoadTable combobox2
lstLoadTable combobox3
Compole error:
Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound function.