Solved

Locking an entire row of True DBGrid

Posted on 2004-04-01
4
2,972 Views
Last Modified: 2008-04-03
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
Thx
Nat
0
Comment
Question by:Gallia
  • 2
4 Comments
 
LVL 3

Expert Comment

by:santosh26676
ID: 10738627
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.

0
 
LVL 39

Accepted Solution

by:
appari earned 150 total points
ID: 10738718
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
Else
    RowStyle.Locked = False
End If
End Sub
0
 
LVL 39

Expert Comment

by:appari
ID: 10738742
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.
0
 

Author Comment

by:Gallia
ID: 10741733
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.

gallia
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now