You are on page 1of 2

8/18/22, 9:01 AM adding a custom text box to a grid - Microsoft: FoxPro - Tek-Tips

Home » Forums » Programmers » DBMS Packages » Microsoft: FoxPro Forum

adding a custom text box to a grid 


thread184-700880

I am trying to add a custom text box to a grid without


success.  

I created  a custom textbox called mytextbox using the


class editor.  In the click event I placed the text

messagebox ("Hello")

I then created a form and added a grid control to the form.


Using tools,options,controls,visual class librairies,

I added the custom class that I created to the form.

I then set the recordsource for the grid to my data table



and placed the following code in forms INIT



WITH thisform.grid1
    LOCAL i

    FOR i=1 TO .columncount


        .columns(i).addobject("mytextbox1","mytextbox")
        .columns(i).CurrentControl="mytextbox1"

        .columns(i).removeobject("Text1")

        .columns(i).sparse=.t.

    NEXT i

ENDWITH

When I run the form the data appears in the grid,


but when I click no message.

When I check for currentcontrol in each column I get


mytextbox1. So that seems to be setting fine.

If I drag my custom text box from the form controls


dialog (view classes) onto the form, a text control called


mytextbox1 is created.  I then run the form

and click on the custom text box and get the

message Hello.  So the custom text box works


outside the
grid but not when placed in the grid.

Does anyone have any suggestion as to why adding the


custom text box to the grid control is not working.

What am I forgetting to set in the grid?

https://www.tek-tips.com/viewthread.cfm?qid=700880 1/2
8/18/22, 9:01 AM adding a custom text box to a grid - Microsoft: FoxPro - Tek-Tips

Thanks for your help


Linda

I found the solution to my problem.


I forgot to set the following property

.columns(i).mytextbox1.visible=.t.

Thanks

Linda

Join | Advertise

Copyright © 1998-2022 engineering.com, Inc. All rights reserved.



of this site constitutes acceptance of
Unauthorized reproduction or linking forbidden without expressed written permission. Registration on or use
our Privacy Policy.

https://www.tek-tips.com/viewthread.cfm?qid=700880 2/2

You might also like