How to populate the fields form?...

Steeve_globetrotterSteeve_globetrotter Member Posts: 46
Hi everybody...

I hope that someone could help me.

Ok, I gonna explain my problem. In fact I have data in the clipboard, I used an OCX for that and it's ok, I can get back the values into a variable in Navision.

My problem is the following :

I would like to copy the content of the variable into a textbox in the form for example...The problem is that I don't know the syntax for this and I can't find this anywhere... ](*,)

CurrForm.<Buy-from Vendor No.> := Clipboard.TextFromClipboard;

I will do a Validate() After in order to keep the automatic fiiling of the others fields.

Help me please...

Thanks a lot to all of you.

Comments

  • kinekine Member Posts: 12,562
    1) You are not assigning the value to some "Edit box"
    2) Each edit box has some source expression (variable or field from record)
    3) You need to assign the value into this variable or field (if possible through VALIDATE).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Steeve_globetrotterSteeve_globetrotter Member Posts: 46
    kine wrote:
    1) You are not assigning the value to some "Edit box"
    2) Each edit box has some source expression (variable or field from record)
    3) You need to assign the value into this variable or field (if possible through VALIDATE).

    Hi,

    Thanks for your quick answer.

    Can you give me an example of how to do that ?

    For example, concerning the "DTA Coding Line" in the invoice form (Form 51). If I want to copy directly the content of my global variable in the Edit Box. How can I do that?

    Thanks a lot again...
  • DenSterDenSter Member Posts: 8,305
    As Kamil explained, in C/AL you don't assign values to textboxes, it just doesn't work that way. In C/AL you set the variables that are bound to the textbox.

    So Let's say you have a form with the buy-from in the header part. I am assuming the Purchase Header table is the sourcetable on the form, and you are working in the C/AL editor on the form itself. You would do simply this:
    VALIDATE("Buy-from Vendor No.",Clipboard.TextFromClipboard);
    
    This will set the field to the value, and it validates it at the same time. Since the field is the source for the textbox on the form, it should automatically update it. If it doesn't, you need to add a CurrForm.UPDATE after you're done.
  • Steeve_globetrotterSteeve_globetrotter Member Posts: 46
    DenSter wrote:
    As Kamil explained, in C/AL you don't assign values to textboxes, it just doesn't work that way. In C/AL you set the variables that are bound to the textbox.

    So Let's say you have a form with the buy-from in the header part. I am assuming the Purchase Header table is the sourcetable on the form, and you are working in the C/AL editor on the form itself. You would do simply this:
    VALIDATE("Buy-from Vendor No.",Clipboard.TextFromClipboard);
    
    This will set the field to the value, and it validates it at the same time. Since the field is the source for the textbox on the form, it should automatically update it. If it doesn't, you need to add a CurrForm.UPDATE after you're done.

    Hi and thanks also for your answer...Your solution seems to be great and functional but I have a small problem to test it in fact...

    I'm again in the form 51 and I defined automatic "No. Series" for the first field in this form (The first field is "No.") and When you focus on the edit box belox the No. Serie come...This is how it works.

    The problem is that I would like to validate directly this first field when I open the form 51 concerning the invoices.

    The system in Navision tells me : "You cannot make any change in the database until a transaction has been started" ](*,)

    Any idea?

    A real big thanks to you, you help me a lot with this

    Take care
Sign In or Register to comment.