1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Custom function

Discussion in 'Questions (Windows Mobile)' started by go4saint, Apr 8, 2008.

Thread Status:
Not open for further replies.
  1. go4saint

    go4saint Guest


    Is there a way to create a custom function, like in Excel VBA ?
    For example a function to multiply two numbers,


    where a and b are 2 text boxes on a form.

    If anyone can give me an example, I will understand better and try to create my own functions.

    Last edited by a moderator: Apr 8, 2008
  2. klaus

    klaus Expert Licensed User

    Yes you can !

    I have added a small example that shows a solution.

    Sub Globals
    'Declare the global variables here.
    End Sub

    Sub App_Start
    End Sub

    Sub Multiply(a,b)
    Return a*b
    End Sub

    Sub Button1_Click
    End Sub
    You can of course use other intermediate variables for the values in the textboxes.

    Best regards
  3. go4saint

    go4saint Guest

    Thanks a lot!
  4. go4saint

    go4saint Guest

    Thanks for solution klaus,

    but there is a problem when I try to compile in both Desktop and Device.

    Error Message CS1525:Invalid expression term ')'
    in line c=Multiply(TextBox1.Text,TextBox2.Text)
  5. specci48

    specci48 Well-Known Member Licensed User

    Hm... there must be a typo or something like that in your personal code because the sample of klaus works fine. Take his attachment and try to compile it, it will work. So I'm sure you implemented his solution manually into your own code.

    Error CS1525 occurs when the compiler detects an invalid character in an expression, so have a close look to you code again.

  6. Erel

    Erel Administrator Staff Member Licensed User

    Thats because you are using a hacked version of Basic4ppc.
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice