Solved

DBGrid Questinon

Posted on 2001-08-14
6
195 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
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!

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

756 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