dataGrid有双击的事件,你双击dataGrid不就有了
要显示详细信息,在另外一个窗体中显示就可以了,至少我是这么做的

解决方案 »

  1.   

    在列样式中绑定AddHandler col2.TextBox.DoubleClick, AddressOf mycell_doubleclick,c2是列样式
    Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown
            If e.Button = MouseButtons.Left Then  'And e.Clicks = 2 当加上前面这句后得不到结果的,因为没有那么敏感的
                Dim myHitTest As DataGrid.HitTestInfo
                myHitTest = DataGrid1.HitTest(e.X, e.Y)
                If myHitTest.Type = DataGrid.HitTestType.Cell Then
                    nowdatetime = Now()
                End If
            End If
        End Sub
        '如果光标进入datagrid和textbox的间隔时间小于系统的默认的鼠标双击时间,则说明是在datagrid中双击的
        Private Sub mycell_mousedown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
            If (DateTime.Now < nowdatetime.AddMilliseconds(SystemInformation.DoubleClickTime)) Then
                gotofrmmaterial()
            End If
        End Sub
      

  2.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=C83C3A4B-8571-4CE6-FBAC-35DC28D14389
      

  3.   

    http://community.csdn.net/Expert/topic/3792/3792193.xml?temp=.2507288
    这里面有一小段是专讲这个的设计思想,你可以参考一下。
      

  4.   

    先在第一列添加一个 pushButton列 命名为"btnDbClick"
    private void dgGoods_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
    {
    e.Item.Attributes.Add("ondblclick",Page.GetPostBackClientEvent(((Button)e.Item.Cells[0].Controls[0]),"")) ;  //非正在编辑的项双击后模拟点击隐藏的编辑按钮。 }
    }private void dgGoods_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    if(e.CommandName == "btnDbClick")
    {
                                   Response.Write("<script>alert('"+e.Item.Cells[1].Text+"');</script>");
    ////////////////////////////看看什么结果
    }
    }