请指教:如何选中datagrid中的一条纪录,双击触发一个on_click事件

xjmj 2005-11-03 07:51:19
如题:
小弟初学vb,望大侠们指教!
...全文
给本帖投票
239 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
faysky2 2005-11-07
  • 打赏
  • 举报
回复
我的想法是选中一条纪录后,双击弹出窗体,进行上面我所说的操作!
------------------------------
Private Sub DataGrid1_DblClick()
Form1.Show '双击弹出窗
End Sub
leckylee 2005-11-07
  • 打赏
  • 举报
回复
我建议你改用rowcolchange事件,click和dbclick用在datagrid都会有问题
faysky2 2005-11-04
  • 打赏
  • 举报
回复
Private Sub DataGrid1_DblClick()
Call Command1_Click'双击调用Command1的单击事件
'要调用其他时间类似地写就行了: Call 事件名称
End Sub
xjmj 2005-11-04
  • 打赏
  • 举报
回复
to: faysky2()
不好意思,我说的不清楚!
我不想在datagrid中,删除,修改,添加
我的想法是选中一条纪录后,双击弹出窗体,进行上面我所说的操作!
上官云峰 2005-11-04
  • 打赏
  • 举报
回复
给你双击触发的例子
Private Sub DataGrid1_DblClick()
On Error Resume Next
Dim strsql As String
'向datagrid4中写入数据
txt_fkid.Text = ""
txt_jhid.Text = DataGrid1.Columns(0)
strsql = "select jh_id as ID,dw_mc as 单位名称,jh_sbmc as 设备名称,jh_gg as 规格型号,"
strsql = strsql & " jh_dw as 单位,jh_dj as 单价,jh_sl as 数量,jh_bfsl as 报废数量,jh_btsl as 补套数量,"
strsql = strsql & " jh_ptsl as 配套数量,jh_je as 金额,jh_bfje as 报废金额,jh_btje as 补套金额 ,jh_ptje as 配套金额,"
strsql = strsql & " jh_fl as 设备编码 ,jh_cj as 厂家 ,jh_hb as 货币 ,jh_bz as 备注 ,jh_year as 年份"
strsql = strsql & " from jhtz_dw_view"
strsql = strsql & " where jh_id=" & txt_jhid.Text
Set Db = New Connection
Db.CursorLocation = adUseClient
Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
Set DataGrid4.DataSource = adoPrimaryRS
DataGrid4.Columns(0).Visible = False
Set Db = Nothing
'如果fk_table里有和txt_jhid匹配的数据,那么在datagrid2中显示
strsql = "select * from jhtz_fk_view where jh_id=" & txt_jhid.Text
Set rs = ExecuteSQL(strsql, msgtext)
If rs.RecordCount > 0 Then
Do While Not rs.EOF
If txt_fkid.Text = "" Then
txt_fkid.Text = rs.Fields("fk_id")
Else
txt_fkid.Text = txt_fkid.Text & "," & rs.Fields("fk_id")
End If
rs.MoveNext
Loop
Else
txt_fkid.Text = ""
End If

strsql = "select fk_id as ID,fk_wczcje_bh as 完成资产流水号,fk_wczcje as 完成资产金额,fk_yfkje_bh as 预付款流水号, fk_yfkje as 预付款金额,fk_fkje_bh as 付款流水号,fk_fkje as 付款金额"
strsql = strsql & " from fk_table"
strsql = strsql & " where jh_id=" & txt_jhid.Text
Set Db = New Connection
Db.CursorLocation = adUseClient
Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
Set DataGrid2.DataSource = adoPrimaryRS
DataGrid2.Columns(0).Visible = False
Set Db = Nothing
End Sub
daisy8675 2005-11-03
  • 打赏
  • 举报
回复
指教:如何选中datagrid中的一条纪录,双击触发一个on_click事件
//你这个问题很奇怪啊

选种datagrid的记录直接去点就行了

on_click事件是你写的吗?不管是不是直接去call就行了
northwolves 2005-11-03
  • 打赏
  • 举报
回复
Dim K As Boolean

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

If Button = 1 Then
K = Not K
If K = False Then ON_CLICK
End If
End Sub

Private Sub Form_Load()
K = False
End Sub
jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签 1.3.6更新 Bug treegrid: getChecked方法不能返回正确的行. fixed. tree: 异步树,在onlyLeafCheck:true时复选框不显示正确. fixed. Improvement treegrid:继承datagrid组件所有的selecting和checking方法。 linkbutton:图标对齐方式,支持值:'top','bottom','left','right'。 linkbutton:添加"size"属性,支持值:'small','large'。 linkbutton:添加的onClick事件。 menubutton:添加"menuAlign"属性,允许用户设置顶级菜单对齐。 combo:添加"panelAlign"属性,支持值:'left','right'。 calendar:"formatter"、"styler"和"validator"选项可用于自定义日历日期。 calendar:添加的onChange事件。 panel:添加"method","queryParams"和"loader"属性。 panel:添加"onLoadError"事件datagrid:添加"onBeginEdit"事件datagrid:添加"onEndEdit"事件datagrid:添加"sort"方法和"onBeforeSortColumn"事件datagrid:"combogrid"编辑器集成到datagriddatagrid:添加"ctrlSelect"属性,允许使用ctrl+click 多选 slider:添加"converter"选项,允许用户决定如何将一个值转换为滑块的位置或滑块位置值。 searchbox:添加"disabled"属性。 searchbox:添加"disabled","enable","clear","reset"方法。 spinner:添加"readonly"属性、"readonly"方法和"onChange事件

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧

手机看
关注公众号

关注公众号

客服 返回
顶部