Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a record from a grid for editing...

Status
Not open for further replies.

shenlon

Programmer
Jul 9, 2003
47
US
What I have is this: One form with a grid on it that displays information from a table. I also have a form that I setup to allow the user to edit information and store new information to said table.

What I want to do is have it so that when the user double clicks on a record in the grid, he will be taken to the 2nd form and be allowed a closer look at the information as well as change it if necessary. The 2nd form is going to be a modal form.

Where should I begin? I've tried fooling around with the dblClick event, but then it only works when I'm clicking in the blank space below the actual records in the table. Thanks in advance for your help.
 
You can use the dblclick event if you trap it in the textbox of each grid column.

Jim
 
I'm sorry, i'm extremely new to VFP 6.0...I don't understand how to trap the dbl click event to the textbox, can you walk me through it?
 
Each textbox in the grid has its own dblclick event. In each one you can place some code like:

DO FORM form2

Does this help?


Jim
 
how do i get to that dblclick event? do you mean through the properties window? If you can, I need like a step-by-step process of how to put DO FORM xxxx in the dblclick event of every textbox
 
Yes, select each textbox in the properties window, double-click on the dblclick event, and add the code.

Jim
 
I must be missing something extremely obvious for me to still not understand when you make it so simple, but I don't see anywhere in the properties window where I can select every textbox. I am using VFP 6.0, so I don't know whether or not that affects anything.
 
You select them one at a time, and add the code to each. -Jim
 
Jim

But would not your solution require subclassing each textboxes used by the Columns of the grid?

To Shenlon
Yes you will have to use the properties window.

1. Right-click on the form
2. Click on 'Properties' on the drop down menu resulting
from step one.
3. You will find the form icon, the little blue icon from
a combo box
4. Click on the combo box and select the grid control that
you are using
5. Down below the grid control will be the first column
control. Below the column control is the Textbox
control that Jim is referring to.

 
No subclassing. Just add code to the dblclick event of each textbox in the grid, one by one. -Jim
 
There has to be something I'm missing, i'm going to post a picture of the properties window and all so that may help. Here's the picture of what I see (had to trim and crop it to get file size down).
foxpro.htm
 
There has to be something I'm missing, i'm going to post a picture of the properties window and all so that may help. Here's the picture of what I see (had to trim and crop it to get file size down). ok, this isn't working the way i want it to :(. Here's the url that you can go to to see the picture: Sorry for the inconvenience.
 
shenlon

Set your columncount to at least 1.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
At this point am not sure what your question actually is. Castor2003 provided some step-by-step instructions - were they helpful? -Jim
 
yea, thanks everyone, I think I have it under control now :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top