Implementing "find" in dbgrid 
Author Message
 Implementing "find" in dbgrid

How do you give the user the ability to search a table on the current
field in a dbgrid? In other words: I have a simple form with just a
dbgrid that connects to a single table. I want the user to be able to
position the cursor in any field in the grid, then click on a command
button that prompts for a value and searches the table on the current
field for that value. I would have thought there would be a built-in
control for this.

I started writing a command button from scratch to do this. My current
problem is that I can't find out how to get the name of the current
field. How do you get the name of the current field in a dbgrid? I
need the field name to use as an argument to the findfirst method.

I've spent well over an hour reading the manuals, reading the online
help, and testing guesses, just to find out how to get the name of the
current field. I feel I have not caught on yet to using the VB manuals
and online help, because the connections often seem convoluted. For
instance, I discovered by chance that you can use the findfirst method
with a data control object by typing data1.recordset.findfirst, but
there is no explict indication in the description of "data control"
that the construction "data1.recordset" is valid. I suspect there
exists a crucial threshhold of familiarity with VB that I need to
cross before I can start finding the information I need in a
reasonable amount of time.

Christopher Schmidt
Tucson, Arizona, USA



Mon, 13 Dec 1999 03:00:00 GMT  
 Implementing "find" in dbgrid

Hi Christopher

You can check out our web site http://www.VBuilder.com and look at our
Query Tools Pro this does a lot of what you are asking for and comes
with full source so you can probably modify it to do exactly what you
need.

HTH
Bruce

Quote:
>How do you give the user the ability to search a table on the current
>field in a dbgrid? In other words: I have a simple form with just a
>dbgrid that connects to a single table. I want the user to be able to
>position the cursor in any field in the grid, then click on a command
>button that prompts for a value and searches the table on the current
>field for that value. I would have thought there would be a built-in
>control for this.
>I started writing a command button from scratch to do this. My current
>problem is that I can't find out how to get the name of the current
>field. How do you get the name of the current field in a dbgrid? I
>need the field name to use as an argument to the findfirst method.
>I've spent well over an hour reading the manuals, reading the online
>help, and testing guesses, just to find out how to get the name of the
>current field. I feel I have not caught on yet to using the VB manuals
>and online help, because the connections often seem convoluted. For
>instance, I discovered by chance that you can use the findfirst method
>with a data control object by typing data1.recordset.findfirst, but
>there is no explict indication in the description of "data control"
>that the construction "data1.recordset" is valid. I suspect there
>exists a crucial threshhold of familiarity with VB that I need to
>cross before I can start finding the information I need in a
>reasonable amount of time.
>Christopher Schmidt
>Tucson, Arizona, USA


Bruce Wojak V Builder Software Inc
708 923 9999   fax 708 923 0207

Web site  www.vbuilder.com


Sat, 18 Dec 1999 03:00:00 GMT  
 Implementing "find" in dbgrid

I will make a few assumptions here:

your dbGrid is connected to a Data Control (this is an object you will have
on your form) The Data control has a recordset and you can use FindFirst as
you have rightly pointed out.

So get the name of the data control ... look up its properties and say...

<data control name>.Recordset.FindFirst "<string you want to find>"
you can then use FindNext to get the next occurence of your string.

The help files should explain it all.

]> >How do you give the user the ability to search a table on the current

Quote:
> >field in a dbgrid? In other words: I have a simple form with just a
> >dbgrid that connects to a single table. I want the user to be able to
> >position the cursor in any field in the grid, then click on a command
> >button that prompts for a value and searches the table on the current
> >field for that value. I would have thought there would be a built-in
> >control for this.

> >I started writing a command button from scratch to do this. My current
> >problem is that I can't find out how to get the name of the current
> >field. How do you get the name of the current field in a dbgrid? I
> >need the field name to use as an argument to the findfirst method.

> >I've spent well over an hour reading the manuals, reading the online
> >help, and testing guesses, just to find out how to get the name of the
> >current field. I feel I have not caught on yet to using the VB manuals
> >and online help, because the connections often seem convoluted. For
> >instance, I discovered by chance that you can use the findfirst method
> >with a data control object by typing data1.recordset.findfirst, but
> >there is no explict indication in the description of "data control"
> >that the construction "data1.recordset" is valid. I suspect there
> >exists a crucial threshhold of familiarity with VB that I need to
> >cross before I can start finding the information I need in a
> >reasonable amount of time.

> >Christopher Schmidt
> >Tucson, Arizona, USA

> Bruce Wojak V Builder Software Inc
> 708 923 9999   fax 708 923 0207

> Web site  www.vbuilder.com



Sun, 19 Dec 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. implementing a "Find" dialog window

2. implementing a "Find" type form

3. Finding "FIND" method

4. "Not implemented" message box

5. "Implements" Problem

6. Using "Implements" in VBScript

7. Multiple-level "Implements"

8. Trouble with "Implements" keyword

9. "Base Class"/Implements

10. COM+/MTS component and "implements"?

11. Type Library - Problems with "Implements" Keyword

12. How to implement "go to line"?

 

 
Powered by phpBB® Forum Software