以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 双击ListView 行,怎么不弹窗口? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=146148) |
||||
-- 作者:hongye -- 发布时间:2020/2/17 17:22:00 -- 双击ListView 行,怎么不弹窗口?
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1") Dim vr As WinForm.ListViewRow = lvw.Current \'获取ListView的当前行 Dim dr As DataRow = vr.tag Dim lr As WinForm.ListViewRow = e.Sender.Current \'MessageBox.Show("你双击的是:" & lr.Text & " " & lr.Group) Dim n As String = "表" & lr.Group.SubString(1,1) Dim ps As Integer = Tables(n).FindRow(dr) If ps >= 0 Then Tables(n).Position = ps Forms("窗口2").Open() Forms("窗口2").Controls("Label2").text = n Forms("窗口2").Controls("Label1").text = Tables(n).Current(5) For i As Integer = 8 To Tables(n).Cols.Count -1 Dim lb As String = "bt" & Format(i-5,"00") Forms("窗口2").Controls("bt" & Format(01,"00")).text = Tables(n).Cols(5).Name & ":" Forms("窗口2").Controls("bt" & Format(02,"00")).text = Tables(n).Cols(6).Name & ":" Forms("窗口2").Controls(lb).text = Tables(n).Cols(i).Name & ":" Dim tb As String = "TextBox" & i-5 Forms("窗口2").Controls("TextBox" & "1").Value = Tables(n).Current(7) & "" & Tables(n).Current(5) Forms("窗口2").Controls("TextBox" & "2").Value = Tables(n).Current(6) Forms("窗口2").Controls(tb).Value = Tables(n).Current(i) Next End If 双击ListView 行,怎么不弹窗口? |
||||
-- 作者:有点蓝 -- 发布时间:2020/2/17 17:28:00 -- 没有给tag赋值 For Each dr As DataRow In DataTables("表A").DataRows \'从数据表中提取数据 Dim vr As WinForm.ListViewRow = lvw.Rows.Add() \'增加一行 vr.tag = dr |
||||
-- 作者:hongye -- 发布时间:2020/2/17 19:52:00 -- 不知道怎么搞,能不能帮我改一下 目的是双击ListViewRow,然后会在窗口2,TextBox显示对应行的数据,并且可以更改, TextBox1 = Tables(n).Current(7) & "" & Tables(n).Current(5)
|
||||
-- 作者:有点蓝 -- 发布时间:2020/2/17 20:14:00 -- 1楼不就是这样用的吗 |
||||
-- 作者:hongye -- 发布时间:2020/2/17 20:18:00 -- 问题是双击ListView行,没有Forms("窗口2").Open() |
||||
-- 作者:有点蓝 -- 发布时间:2020/2/17 20:34:00 -- 窗口肯定要打开才能使用里面的控件呀,如果已经打开,直接使用即可 Forms("窗口2").Controls("Label1").text = Tables(n).Current(5)
|
||||
-- 作者:hongye -- 发布时间:2020/2/17 20:50:00 -- 实列已经上传,你帮我看一下, 问题是双击ListView行,没有Forms("窗口2").Open() 如果像下面这样的话,TextBox显示不正确 Dim lvw As WinForm.ListView = e.Form.Controls("ListView1") Dim vr As WinForm.ListViewRow = lvw.Current \'获取ListView的当前行 Dim dr As DataRow = vr.tag Dim lr As WinForm.ListViewRow = e.Sender.Current \'MessageBox.Show("你双击的是:" & lr.Text & " " & lr.Group) Dim n As String = "表" & lr.Group.SubString(1,1) Forms("窗口2").Open() Forms("窗口2").Controls("Label2").text = n Forms("窗口2").Controls("Label1").text = Tables(n).Current(5) For i As Integer = 8 To Tables(n).Cols.Count -1 Dim lb As String = "bt" & Format(i-5,"00") Forms("窗口2").Controls("bt" & Format(01,"00")).text = Tables(n).Cols(5).Name & ":" Forms("窗口2").Controls("bt" & Format(02,"00")).text = Tables(n).Cols(6).Name & ":" Forms("窗口2").Controls(lb).text = Tables(n).Cols(i).Name & ":" Dim tb As String = "TextBox" & i-5 Forms("窗口2").Controls("TextBox" & "1").Value = Tables(n).Current(7) & "" & Tables(n).Current(5) Forms("窗口2").Controls("TextBox" & "2").Value = Tables(n).Current(6) Forms("窗口2").Controls(tb).Value = Tables(n).Current(i) Next |
||||
-- 作者:hongye -- 发布时间:2020/2/17 20:54:00 -- 此主题相关图片如下:01.jpg |
||||
-- 作者:有点蓝 -- 发布时间:2020/2/17 20:56:00 -- 改回1楼的用法即可。 |
||||
-- 作者:hongye -- 发布时间:2020/2/17 20:58:00 -- 一楼的打不开“窗口2” |