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:
01365236
Vues:
13
You maybe right. I found the way to get around the problem was to create another column, first one. And then, manipulate the object of the second column. Thank you for your help.

>
>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform