VB mshflexgrid不能选择行列

原文: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樵客

此条目发表在 程序设计 分类目录。将固定链接加入收藏夹。

关于 logger

2010年网络规划设计师证书寻挂靠!

VB mshflexgrid不能选择行列》有 4 条评论

  1. 找了一个晚上的资料,终于……

    记住这个站点http://support.microsoft.com/

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

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

  4. 逍遥之魅 回复

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

发表评论

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

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>