Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

whats the difference?

  • 13-10-2002 7:19pm
    #1
    Registered Users, Registered Users 2 Posts: 446 ✭✭


    Hi very quick question I have a prog thats taking in and printing numbers into text boxes soon these in the properties I changed them from General to Number.

    Is this the same as doing say:

    Ans = Val(txtNumber.text)?


Comments

  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    I assume this is VB ?

    Val() returns the numbers in a string in the appropriate number format

    is Val("123") returns 123 as integer
    Val ("12 oclock") returns 12 as integer
    Val("1234567 seconds left") returns 1234567 as long
    Val("no numbers") returns 0 as integer

    you should really check if its a number first using
    IsNumeric

    e


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by kegan5
    Is this the same as doing say:

    Ans = Val(txtNumber.text)?
    Given you're talking about 'General to Number' conversions, I assume you're talking about the automatic conversion that VBA text boxes will do for you? It's more likely that it's doing an equivalent of:

    Ans = CDbl(txtNumber.text)

    ...as it is less strict on casting certain values. An IsNumeric is implicit, depending upon the control's data source, AFAIR.


Advertisement