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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding a custom text box to a grid

Status
Not open for further replies.

LindaRichard

Programmer
Feb 23, 2001
103
0
0
CA
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?

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top