Solved

DBGrid Questinon

Posted on 2001-08-14
6
193 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…

776 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