MSHFlexGrid的bug ,该如何解决?

ytweiwei 2003-12-19 12:00:49
发现一严重问题,当我在一个函数中连续用Rows设置两次行数时,实际上只有第一次设置的有效,而第二次就无效了,但控件并没有报错,害的我找了半天的程序BUG。
...全文
43 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
muchtrouble2003 2003-12-19
  • 打赏
  • 举报
回复
以前遇到过,不过很少
CNSuper 2003-12-19
  • 打赏
  • 举报
回复
这应该是一个 BUG!!!!!!

FIX: Changes to MSHFlexgrid Adding/Removing Records Not Visible
适用于
This article was previously published under Q223083
SYMPTOMS
After using the Remove method of the MSHFlexGrid, rows added with the AddItem method may not be visible.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:


194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed

MORE INFORMATION
Steps to Reproduce Behavior
Create a new standard Visual Basic project. Form1 is create by default.
Add the MSHFlexGrid to the Visual Basic toolbox.
Place an MSHFlexGrid and two CommandButtons on the form.
Add the following code to your application:Private Sub Command1_Click()
MSHFlexGrid1.AddItem "Hello"
End Sub

Private Sub Command2_Click()
MSHFlexGrid1.RemoveItem MSHFlexGrid1.Rows - 1
End Sub

Private Sub Form_Load()
Command1.Caption = "AddItem"
Command2.Caption = "RemoveItem"
End Sub



Run the project
Click the "Command1" button three times to add three rows.
Click the "Command2" button three times to remove the three rows.
Click the "Command1" button three times again to add back the three rows.
If you're using the MSHFlexGrid prior to the version that shipped with Visual Basic 6.0 Service Pack 3, you won't see the second batch of rows created by clicking the AddItem button.

With the version of MSHFlexGrid that shipped with Visual Basic 6.0 Service Pack 3, this problem does not occur.
The information in this article applies to:
Microsoft Visual Basic Professional Edition for Windows 6.0
Microsoft Visual Basic Enterprise Edition for Windows 6.0
Last Reviewed: 1/11/2001 (1.0)
Keywords: kbbug kbCtrl kbVS600sp3fix KB223083
jhzhou882 2003-12-19
  • 打赏
  • 举报
回复
我觉得是你代码的问题.
用DEBUG仔细找找.
ytweiwei 2003-12-19
  • 打赏
  • 举报
回复
绝对不骗你们,我是在VC程序中使用这个控件的,但是效果应该是一样的。
这个BUG并不是在所有情况下才出现,我测试过,当第二次设置Row时只有在比第一次多一行,并且是在第二次以上这种操作时才会出现。
SoHo_Andy 2003-12-19
  • 打赏
  • 举报
回复
MSHFlexGrid也试过了,一样的结论
SoHo_Andy 2003-12-19
  • 打赏
  • 举报
回复
测试代码
Private Sub Command1_Click()
MSFlexGrid1.Rows = 5
MSFlexGrid1.Rows = 10
End Sub

Private Sub Command2_Click()
MSFlexGrid1.Rows = 10
End Sub

Private Sub Command3_Click()
MSFlexGrid1.Rows = 5
End Sub

Private Sub Command4_Click()
MSFlexGrid1.Rows = 10
MSFlexGrid1.Rows = 5
End Sub
jhzhou882 2003-12-19
  • 打赏
  • 举报
回复
会吗?
不是吧
SoHo_Andy 2003-12-19
  • 打赏
  • 举报
回复
我试了一下Rows设置,和楼主的描述不同

两次赋值实际上都有效,表现出的是第二次赋值的结果

分开赋值则有效没有问题

没有bug,不知楼主是不是有些地方操作没有说明白
landongfang 2003-12-19
  • 打赏
  • 举报
回复
没有使用Refresh

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧