Solved

DBGrid Questinon

Posted on 2001-08-14
6
190 Views
Last Modified: 2007-12-19
How do i programmaticly highlight a record on a DBGrid. I see all kinds of methods like SelLength, SelStart, SelStartCol, etc. but none of them select the entire row. Any suggestions?
0
Comment
Question by:Maxim10553
  • 3
  • 2
6 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 6385030
With DBGrid1
  .SelStartCol = 0
  .SelEndCol = .Columns.Count - 1
End With

Should do it.
0
 
LVL 3

Author Comment

by:Maxim10553
ID: 6385054
that selects the entire table. i only want a paticular row selected
0
 
LVL 3

Expert Comment

by:Diveblue
ID: 6385121
You can use the selbookmarks collection

SSDBGrid1.SelBookmarks.Add (SSDBGrid1.RowBookmark(rownum))

hope this helps
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 3

Author Comment

by:Maxim10553
ID: 6385166
Here is the code that will change the highlighted row based on what the user selects

Private Sub DBGrid1_RowColChange(LastRow as Variant, ByVal LastCol as Integer)

DBGrid1.SelBookmarks.Add (DBGrid1.RowBookmark(data1.recordset.absoluteposition))

End Sub

the problem is that if i select a record that is past the number of records that are currently shown i.e i go to the end of the file i get an error Invalid Row Number
0
 
LVL 3

Accepted Solution

by:
Diveblue earned 50 total points
ID: 6385216
If this is a bound grid try
SSDBGrid1.SelBookmarks.Add (SSDBGrid1.Bookmark)


.Bookmark refers to the current row's bookmark..

Hope that works
0
 
LVL 3

Author Comment

by:Maxim10553
ID: 6385297
ty, worked nicely
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

18 Experts available now in Live!

Get 1:1 Help Now