Newbie using VFP needs help.

  • I am evaluating this wonderful control and am trying to get some help on how to save changes to the interface using Visual Foxpro. I am attempting to bind it to a database and have it automatically save changes. I am having a problem saving changes. I thought it was suppose to automatically save changes if you assign the datasource to a binary field in your table, if so how to do this, if not how to save changes just before exiting the form

    Any help would be greatly appreciated.

    Thanks!

    • Offizieller Beitrag

    I am sorry - I do not know FoxPro - only that there are developers wou
    use TextDynamic with it.

    The "Text" property usually attached to the database. I don't know
    hopw this is done in FoxPo.

    If you do it in code (in an event) you can use the Memo.SaveToStream
    or SaveToString method.

  • Thank you for the quick reply. I dabbled with it based on your suggestion and have found the following works:

    step 1. Create form

    add control either through the toolbox or create a class based on oleobject(not bound oleobject).

    Drop it onto the form.

    Size to your needs and then set anchor property to 15.

    in the init event of the form code window put this:

    SQL
    SELECT mytableLOCATE for(whatever condition)thisform.txtcontrol1.OBJECT.TextFormat='RTF-nobinary'STORE  ALLTRIM(mytable.fieldname) TO mystring1thisform.txtcontrol1.object.setText(1,mystring1,'RTF-nobinary',.f.)

    Next step is to control the saving function there are two places to put this code. I would suggest both

    in the destroy event :

    SQL
    SELECT mytable
    mystring= thisform.txTCONTROL1.object.getText(1,'RTF-nobinary',.f.)
    replace mytable.fieldname WITH mystring IN mytable

    In the Deactivate event (if desired)same code as above
    You may want to check for changes and ask if you want to save changes prior to saving.

    Please note that some activex methods and properties when substantiated in VFP will not behave if you omit the .object reference. I have noticed this in other activex controls that I use on a regular basis.
    I hope this helps any other VFP programmers who are considering using this awesome tool.