Solved

Locking an entire row of True DBGrid

Posted on 2004-04-01
4
3,094 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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