读书人

datagrid控件数组有关问题

发布时间: 2013-12-04 17:21:02 作者: rapoo

datagrid控件数组问题
能否在datagrid控件数组上实现鼠标右击菜单?
单个控件我可以实现:


Private sub datagrid1_mousedown(button as integer,shift as integer,x as single,y as single)
if button and vbrightbutton then
popupmenu wj
end if
end sub


我有6个datagrid,需要做控件数组,不知如何调用右击菜单的WJ.请各位指点,谢谢!
[解决办法]
一样的写法,先把这些控件编成数组,然后写事件,多一个Index参数区分。
[解决办法]

首先,确认你的 DataGrid 是做成数组的。

其次,控件编辑界面双击在双击 DataGrid 进入代码编辑界面时,从事件下拉列表中选择 MouseDown,让系统自动生成事件声明:

Private Sub DataGrid1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

End Sub

一看你的小写字母,就知道你的声明代码不是系统生成的。

读书人网 >VB

热点推荐