• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3251
  • Last Modified:

Locking an entire row of True DBGrid

Hi experts,

Can someone tell me how to lock the current row according to the value of a field in that row ?

I am using VB6 and TDBGrid Pro 8.0
  • 2
1 Solution
I have not used TRUE DBGrid but you could do the following:

On rowcolchange event check the contents of the column and based on the value set the current row to next row or previous row.

set the FetchRowStyle property of the grid to true(in properties, splits tab expand the split0(default) and change property of FetchRowStyle to true). add the following code. this one checks if column 0 text if it is Zero then locks the row otherwise not.

Private Sub TDBGrid1_FetchRowStyle(ByVal Split As Integer, Bookmark As Variant, ByVal RowStyle As TrueDBGrid60.StyleDisp)
If TDBGrid1.Columns(0).CellText(Bookmark) = "0" Then
    RowStyle.Locked = True
    RowStyle.Locked = False
End If
End Sub
you are using TDB8.0
my grid version is tdb6, must be simillar in version 8. basic idea is set the property fetchrowstyle to true and write code in fetchrowstyle event.
GalliaAuthor Commented:
Thanks Appari,

I confirm, TDB8.0 is the same as TDB6 (regarding fetchrowstyle).
I wil post 2 more questions (1-Duplicate rows in TDB8.0, 2-Adding new row in unbound TDB8), please if you have time, take a look.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now