Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

DBGrid Questinon

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
Maxim10553
Asked:
Maxim10553
  • 3
  • 2
1 Solution
 
TimCotteeCommented:
With DBGrid1
  .SelStartCol = 0
  .SelEndCol = .Columns.Count - 1
End With

Should do it.
0
 
Maxim10553Author Commented:
that selects the entire table. i only want a paticular row selected
0
 
DiveblueCommented:
You can use the selbookmarks collection

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

hope this helps
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Maxim10553Author Commented:
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
 
DiveblueCommented:
If this is a bound grid try
SSDBGrid1.SelBookmarks.Add (SSDBGrid1.Bookmark)


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

Hope that works
0
 
Maxim10553Author Commented:
ty, worked nicely
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now