Image of Navigational Panel mapped to Contents / Home / Search True DBGrid 4.0
Tech Support Question

Image of Line Break

Q. I'm using the KeyDown event to control the arrows and enter keys. How can I test if a row is in edit mode (a pencil is in the row header), and how can I force the update?

A. You can determine whether there is an edit in progress using the grid's EditActive property - which will return True if an edit is in progress. You can determine if there is an update pending (a pencil icon is displayed in the RecordSelector) using the grid's DataChanged property - which will return True if an update is pending. If you are using the grid bound to a database via the data control, you can simply issue a Data1.UpdateRecord to update any changed data to the Recordset.

Q. I'm using True DBGrid Standard with VB4 and I can't find a way to make the whole row highlighted when the user selects any column in that row. I used to do this with the MarqueeStyle property. I can't find any reference to this in the Help.

A. True DBGrid Standard does not support the MarqueeStyle property which can be set to 'Highlight Row' or 'Highlight Row, Raise Cell.' You can approximate this behaviour, however, by selecting the current record in the grid's RowColChange event. Example:

  Private Sub TDBGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    ' Test if row change
    If TDBGrid1.Bookmark <> LastRow Then 
    ' Select current record by adding its bookmark to the SelBookmarks collection
        TDBGrid1.SelBookmarks.Add TDBGrid1.Bookmark
    End If
  End Sub

The full-featured retail version, True DBGrid 4.0, supports the MarqueeStyle property.

Q. I'm trying to remove the small, whitespace border that appears around a graphic in a cell. It's seriously messing up the appearance of my grid. Is there any way to do this?

A. I've made exactly the same mistake! The grid does not add a whitespace border to in-cell bitmaps. Are you sure that it is not your bitmap which has the whitespace border? The only other thing that it might be is the background colour of the column containing the bitmaps - if the cell displaying the bitmap is sized larger than the bitmap, then the background colour of the column will be visible around the bitmap. Changing this column's backcolour property will verify whether or not this is the case.

Q. I have two bound grids using Jet 2.0. While editing a column in grid 1, I move the mouse to grid 2 and click. Grid 2 does not getfocus. I have done this before with good results.

A. This problem has been acknowledged by APEX Software. It only occurs when editing a grid cell. To work around this you need to force the grid to exit edit mode before the focus change takes place. The best way to do this would be to test for the ActiveControl.Tag in the grid's MouseMove event, and if the ActiveControl.Tag is equal to the grid's Tag property - and if the grid's EditActive property is True - then set EditActive equal to False. You will need to do this for both grids. Example:

  Sub Table1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
    If form1.ActiveControl.Tag = "table2" And table2.EditActive = True Then
      table2.EditActive = False
    End If
  End Sub

  Sub Table2_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
    If form1.ActiveControl.Tag = "table1" And table1.EditActive = True Then
      table1.EditActive = False
    End If
  End Sub

You will need to set each grid's Tag property as they are not set by default.


Note : The following two questions have been answered by APEX Technical Support of the APEX Software Corporation. You can email them at : support@apexsc.com.


Q. I have VB4.0 and I upgraded to True DBGrid and I would like to know how to size each individual column at run time?

A. If you want to size a column at runtime through code you would use the following code. Example:

  TDBGrid1.Columns(1).Width = Single

This property returns or sets the width of a column in terms of the coordinate system of the grid's container.

If you want the user to be able to size columns at runtime you will have to set the AllowSizing property of the grid to True(which is the default). When they move the mousepointer to the column divider line in the header it will turn to two arrows and they can click and hold the left mouse button to drag the column either larger or smaller.

Q. Why is there a GPF when you are trying to set the value of a cell in a DBGrid control (which was distributed with VB 4.0 Professional)? I would like to set the value of two columns when a new record is being added in the grid. Here is how I go about doing it...

  sub grid1_aftercolupdate( byval colindex as integer)
    grid1.columns(1).text = <value 1>
    grid1.columns(2).text = <value 2>
  end sub

The above syntax works well with True DBGrid Standard (1.0.0106) but does not work with DBGrid (1.0.086). Also GPFs occur when the data control is refreshed in both scenarios.

A. The DBGrid which ships with VB4 does not allow you to set the Text or Value properties of the grid at run-time (these are read-only properties). This is not a bug; it is done by design. However, in True DBGrid Standard, the Text and Value properties can be set at run-time (they are read/write properties).

If you are using the DBGrid which ships with Visual Basic 4.0 we recommend that you upgrade to True DBGrid Standard. True DBGrid Standard is a free upgrade to DBGrid and was written to add a few powerful features to DBGrid, fix critical errors discovered by users of DBGrid, and to provide users with full on-line documentation and tutorial projects. True DBGrid Standard also comes with a migration utility add-in which will allow you to easily convert an existing application which uses DBGrid to use True DBGrid Standard instead.

The latest version of True DBGrid Standard can be downloaded from CompuServe, Anonymous FTP site or WWW page.

Instructions for downloading the appropriate file:

Downloading Instructions for: True DBGrid Standard Full Version

File(s) to get: tdbgsx16.exe (16-bit version)
- OR -
tdbgsx32.exe (32-bit version)

Anonymous FTP Server:ftp.apexsc.com
When you log in, and are prompted for a user name, type "anonymous" and then type in your e-mail address as your password. You can find the file in the /pub/ocx directory.

World Wide Web: www.apexsc.com
Click on the "True DBGrid Standard Latest Version" link on our home page. Then click on the appropriate icon to download either the 16 or 32 bit version. Be sure to download the "Full Version" if you do not already have True DBGrid Standard on your system.

CompuServe: go apex
Search our forum library (COMPA forum, APEX library) for the files you need and download them.


Notes:
The file(s) are self-extracting archive files. Just place the file in a temporary directory and run it. It will extract all of the appropriate files and install True DBGrid Standard.

I suggest you try this first and see if this version will help your problem.

True DBGrid Standard contains a Migration tool to convert your old DBGrid projects so they can be used with True DBGrid Standard. For more information, check the documentation included with True DBGrid Standard.


Image of Arrow to Previous Article Image of Arrow to Next Article

[TECH SUPPORT TOC]
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]