Solved

DBGrid Questinon

Posted on 2001-08-14
6
191 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

863 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