[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Select rows in a DBGrid.

Posted on 1997-07-23
3
Medium Priority
?
281 Views
Last Modified: 2006-11-17
Hi experts,

How to select / highlight a set of continued records in a DBGrid by mouse clicks and let the program know what are selected? I can't find anything representing the selected row numbers in the DBGrid.

Thank you.
0
Comment
Question by:victorlong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
y96andha earned 150 total points
ID: 1428757
Use the SelBookmarks property. This comes directly from the online help:

Returns a collection of bookmarks for all selected records in the DBGrid control.

Syntax

object.SelBookmarks

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

When a record is selected in the DBGrid control, its bookmark is appended to the collection returned by the SelBookmarks property.  For example, if you create a clone of the Recordset object created by the DBGrid control, you can process individual data records by repositioning the cloned Recordset with bookmarks taken from the SelBookmarks collection.  

0
 

Author Comment

by:victorlong
ID: 1428758
Hi y96andha...(Sorry, not your first name :-)),

Thank you for your reply and help. You may know I am a beginer...I still not really understand:

1) When select the rows in a DBGrid, I can't find the way like sececting continued files in Windows by Shift + Click.
2) What the DBGrid.SelBookmarks really represents? Is that the row numbers or need to add another dot and somthing like DBGrid.SelBookmarks(i).row

Cheers.

Victor
0
 
LVL 5

Expert Comment

by:y96andha
ID: 1428759
This is a code sample to get a selected record:

dim rs as recordset
rs = dbgrid1.recordset.clone
rs.bookmark = dbgrid1.selbookmarks(1)

rs is now positioned at the first selected record of the DBGrid.




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.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

656 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