Reference a form control in a formula

Posted by: snielsen on 8 September 2017, 2:10 pm EST

  • Posted 8 September 2017, 2:10 pm EST

    I would like to have a textbox on my form where the user can enter a percentage.  then I want to use that percentage in a cell formula to factor the value in another column.  Something like, "=RC3 * {Textbox1.text}.  Any suggestions on how to best implement this?  {Textbox1.text} could also be a global variable in the VB code, i.e. Public gInterest as long.  I'mworking in VB.Net, 2.0 framework.


     

  • Replied 8 September 2017, 2:10 pm EST

    Hello, 

    You may use variables in formula.Please look at the code snippet below that might help you to achieve  what you want.

      Dim str As Long

            str = CType(TextBox1.Text, Long)

            FpSpread1.ActiveSheet.Cells(0, 1).Formula = "PRODUCT(R1C3," & str & ")" 

    I hope it will help you.

    Thanks,

     

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels