Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error at Grid.Column.AddObject
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01365213
Message ID:
01365235
Vues:
17
This message has been marked as the solution to the initial question of the thread.
>I am working on the problem with Grid and memo I started in another thread. I am trying to use the code provided by Borislav to zero in on the problem. Here is what I am doing. In the INIT method of the form, I want to initialize grid to have one column only and to have EditBox in this column bound to the memo field of the cursor. I pointed below (in line) where I get an error:

I think the problem is that:
thisform.Grid.Column1.controlsource is not char data type field in this line
thisform.Grid.Column1.AddObject("Edit1","EditBox")
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   12/02/08 10:49:03 PM
DEFINE CLASS form1 AS form
    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"

    ADD OBJECT grid AS grid WITH ;
        ColumnCount = 1, ;
        Height = 223, ;
        Left = 34, ;
        Panel = 1, ;
        RecordSource = "", ;
        RowHeight = 43, ;
        Top = 14, ;
        Width = 296, ;
        Name = "Grid", ;
        Column1.ControlSource = "", ;
        Column1.Width = 254, ;
        Column1.Name = "Column1"

    PROCEDURE Init
        CREATE CURSOR crsTest (MyMemo Char(50))
               INSERT INTO crsTest VALUES([Test])
               INSERT INTO crsTest VALUES([Yes])

        thisform.Grid.columncount = 1
        thisform.Grid.Column1.Sparse = .F.
        thisform.Grid.Column1.Name = "Column1"
            
        thisform.Grid.Column1.RemoveObject([Text1])
        thisform.Grid.Column1.controlsource = "crsTest.MyMemo"
        thisform.Grid.Column1.AddObject("Edit1","EditBox")     && !! No error on this line.
        thisform.Grid.Column1.Edit1.Visible = .t.

        thisform.Grid.RecordSourceType = 1
        thisform.Grid.RecordSource = [crstest]

        thisform.Grid.Column1.controlsource = "crsTest.MyMemo"
        GO TOP
        ThisForm.grid.Refresh 
    ENDPROC
ENDDEFINE
*-- EndDefine: form1
**************************************************
and with this code
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN

**************************************************
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   12/02/08 10:56:06 PM
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT grid AS grid WITH ;
		ColumnCount = 1, ;
		Height = 223, ;
		Left = 34, ;
		Panel = 1, ;
		RecordSource = "", ;
		RowHeight = 43, ;
		Top = 14, ;
		Width = 296, ;
		Name = "Grid", ;
		Column1.ControlSource = "", ;
		Column1.Width = 254, ;
		Column1.Name = "Column1"

	PROCEDURE Init
		CREATE CURSOR crsTest (MyMemo I)
		       INSERT INTO crsTest VALUES(2)
		       INSERT INTO crsTest VALUES(3)

		thisform.Grid.columncount = 1
		thisform.Grid.Column1.Sparse = .F.
		thisform.Grid.Column1.Name = "Column1"
		    
		thisform.Grid.Column1.RemoveObject([Text1])
		thisform.Grid.Column1.controlsource = "crsTest.MyMemo"
		thisform.Grid.Column1.AddObject("Edit1","EditBox")     && !! I get error on this line.
		thisform.Grid.Column1.Edit1.Visible = .t.

		thisform.Grid.RecordSourceType = 1
		thisform.Grid.RecordSource = [crstest]

		thisform.Grid.Column1.controlsource = "crsTest.MyMemo"
		GO TOP
		ThisForm.grid.Refresh 
	ENDPROC
ENDDEFINE
*-- EndDefine: form1
**************************************************
HTH

>
>
>*--- INIT method of the form
>thisform.Grid.columncount = 1
>thisform.Grid.Height = 200
>thisform.Grid.Left = 20
>thisform.Grid.Panel = 1
>thisform.Grid.RowHeight = 85
>thisform.Grid.Top = 26
>thisform.Grid.Width = 320
>	
>thisform.Grid.Column1.Width = 278
>thisform.Grid.Column1.Sparse = .F.
>thisform.Grid.Column1.Name = "Column1"
>	
>thisform.Grid.Column1.RemoveObject([Text1])
>thisform.Grid.Column1.AddObject("Edit1","EditBox")     && !! I get error on this line.
>thisform.Grid.Column1.Edit1.Visible = .t.
>thisform.Grid.Column1.controlsource = "V_MYVIEW.MYMEMO"
>
>
>I get the following error on line .AddObject:
>
>Error with Edit1 - Value: Data Type Mismatch
>Error No. 1881.
>
>If I click on ignore, I get to see the grid. But what does the error above mean? How to change the code to avoid the error?
>
>Thank you.
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform