The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Visual Basic 6 - DBGrid, Empty Cells AllowSizing Bug?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
David Cumps

Posts: 319
Nickname: cumpsd
Registered: Feb, 2004

David Cumps is a Belgian Student learning .NET
Visual Basic 6 - DBGrid, Empty Cells AllowSizing Bug? Posted: Apr 1, 2004 12:27 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by David Cumps.
Original Post: Visual Basic 6 - DBGrid, Empty Cells AllowSizing Bug?
Feed Title: David Cumps
Feed URL: http://weblogs.asp.net/cumpsd/rss?containerid=12
Feed Description: A Student .Net Blog :p
Latest .NET Buzz Posts
Latest .NET Buzz Posts by David Cumps
Latest Posts From David Cumps

Advertisement
Something not .NET related, regarding VB6.

Here is some strange behaviour:

Create a new .EXE project with the following References and Components:

References : Microsoft DAO 3.51 Object Library
Components : Microsoft Data Bound Grid Control 5.0 (SP3)

Add a DBGrid to your form with it's DataSource set to datQuery (Data).

Add a textbox and a button as well, and put this code in it:
1Option Explicit

2
3Private Sub cmdExecute_Click()
4 Call LoadTable(txtquery.Text)
5End Sub
6
7Private Sub LoadTable(strQuery As String)
8 Dim Db As Database, Rs As Recordset
9
10 Set Db = DBEngine.Workspaces(0).OpenDatabase(dbPath)
11 Set Rs = Db.OpenRecordset(strQuery)
12 Rs.MoveLast
13 Rs.MoveFirst
14 Set datQuery.Recordset = Rs
15
16 Me.Caption = "Query - Colums: " & Rs.Fields.Count & " - # Records: " & Rs.RecordCount
17End Sub
18

Run your code, and this is what it should look like:



Now, go to the Custom properties of the DBGrid, to the Layout tab and uncheck 'AllowSizing'.



Run your program again, and now your DBGrid will indicate there are results, but there will be no text, like this:



Why is it doing this? I really have no idea. But the best part is, when you check the AllowSizing property again, it isn't back to normal. It stays broken.

This 'bug' (don't know if it's a bug) was encountered some days ago, I reproduced it this afternoon, and now I installed VS6 SP6, but the bug remains.

If anyone wants a project which has the bug in it, I uploaded something small (30Kb) that got destroyed by this.

Anyone who has encountered this as well? And perhaps has an explenation of why it's doing this.

Update: Just when I posted this and looked at my post again, I noticed something, the second screenshot only had 2 columns, so I realised it did fetch the records, but didn't knew where to display the data. And when you right click and choose 'Clear Fields' it works again. But the AllowSizing is automatically checked on again. To add some value to this post, maybe anyone knows how to uncheck AllowSizing without the grid resetting it's own columns?

Read: Visual Basic 6 - DBGrid, Empty Cells AllowSizing Bug?

Topic: I want my WSE Previous Topic   Next Topic Topic: Geek Notes 2004-03-31

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use