" id="b1img" alt="米课”N+1“思维建站-非官方免费技术支持,Wordpress/Zencart/Opencart建站、SEO" title="米课”N+1“思维建站-非官方免费技术支持,Wordpress/Zencart/Opencart建站、SEO">
  • " alt="米课”N+1“思维建站-非官方免费技术支持,Wordpress/Zencart/Opencart建站、SEO" title="米课”N+1“思维建站-非官方免费技术支持,Wordpress/Zencart/Opencart建站、SEO" />
  • " alt="Windows/Linux服务器运维技术支持 环境搭建、应用发布、服务器管理、虚拟化、云计算" title="Windows/Linux服务器运维技术支持 环境搭建、应用发布、服务器管理、虚拟化、云计算" />
  • " alt="高校/小型企业网络运维与建设免费技术支持,网络规划、网络优化、故障排除、网络管理" title="高校/小型企业网络运维与建设免费技术支持,网络规划、网络优化、故障排除、网络管理" />

VB mshflexgrid不能选择行列

程序设计2006-06-22 itlogger阅读(818) 评论(4)

原文:http://support.microsoft.com/kb/267745/en-us

[b]BUG: Hierarchical Flexgrid Row or Cell Selection Fails After Being Bound to an Empty Recordset

[/b]

SYMPTOMS

The Hierarchical Flexgrid control does not properly select rows or cells after it has been bound to an empty recordset and then rebound to a recordset that contains data. When you click a cell or a row, no row or cell is selected, or a row or cell that was not clicked is selected. When you use the EnterCell property of the grid to display the value in the cell you clicked, a value from a cell located above the cell you clicked displays instead.   Back to the top

RESOLUTION

To work around this problem, test for the condition of an empty recordset prior to binding a recordset to the Hierarchical Flexgrid control. If the recordset is empty, disable the grid and do not set the empty recordset to the Datasource property. Later, if a recordset is retrieved that does contain data, enable the grid and bind the control as usual.

注:这是VB的一个BUG,当mshflexgrid绑定一个空记录时,就会出现不能点选任意记录(行、列)

解决方法:

Rs.Open "select port,tdesc from ptag ", Cnn, 1, 3

if rs.eof then

……

Set PtagGrid.DataSource = Rs(先判断记录是否为空,如果不为空才把RS绑定给mshflexgrid)

end if

转载请注明 :IT樵客
文章地址:http://www.itlogger.com/program/321.html

4 thoughts on “VB mshflexgrid不能选择行列

  1. 如果用ADODC进行数据绑定如何判断结果集是否为空呢?

  2. id五年 回复@

    注意recordset的cursortype类型,四种类型中,前两种还要关闭recordset,再次打开,后两种不用

  3. 逍遥之魅 回复@

    顶顶顶顶顶顶顶顶,找了一百年的资料终于在你这里找到了,谢谢楼主!!!

发表评论

电子邮件地址不会被公开。 必填项已用*标注