以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  【已解决】[求助]我对ListView不是很熟,我想双击某行修改后台数据,该怎么写?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=153831)

--  作者:zto001
--  发布时间:2020/8/24 20:11:00
--  【已解决】[求助]我对ListView不是很熟,我想双击某行修改后台数据,该怎么写?
[求助]我对ListView不是很熟,我想双击某行显示某行对应的后台数据,该怎么写?

我写在双击控件里面
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")

Dim vr As WinForm.ListViewRow = lvw.Current
\'Messagebox.show( vr("序号"),"提示",MessageBoxButtons.OK,MessageBoxIcon.Information)

Dim cmd As new SQLCommand
cmd.Connecti
cmd.CommandText = "Select * From {Eims_快递公司} Where [_Identify] = \'" & vr("ID") & "\'"
Dim dt As DataTable = cmd.ExecuteReader(True)

Tables ("快递设置_Table1").DataSource =dt

直接提示错误了

[此贴子已经被作者于2020/8/25 11:31:07编辑过]

--  作者:有点蓝
--  发布时间:2020/8/24 20:22:00
--  
放到RowActivate事件http://www.foxtable.com/webhelp/topics/2872.htm
--  作者:zto001
--  发布时间:2020/8/24 23:28:00
--  
这段代码是放在RowActivate里面,但是我一双击或者换行就出错,是我哪段写错了吗?
--  作者:有点蓝
--  发布时间:2020/8/25 8:35:00
--  
提示什么错误?
--  作者:zto001
--  发布时间:2020/8/25 9:14:00
--  
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:窗口,快递设置,ListView1,RowActivate
详细错误信息:
未将对象引用设置到对象的实例。

--  作者:有点蓝
--  发布时间:2020/8/25 9:17:00
--  
Dim vr As WinForm.ListViewRow = lvw.Current
if vr is nothing then return
……