Newbie Questions

Discussion in 'Questions (Windows Mobile)' started by Bruno, May 5, 2008.

  1. Bruno

    Bruno Member Licensed User

    Hi there,

    Two little questions:

    How to dispaly (using 'Format')
    1.2345678 like this 001.123
    something like Format(1.23456,"D3F3") ?

    and then

    Dim Type (name,age) person
    Dim Type (name,age) other_person

    How to copy directly person => other_person

    whithout made:
    other_person.name=person.name
    other_person.age=person.age

    Many thanks !!!!!
    Bruno.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can copy the struct with ArrayCopy:
    Code:
    ArrayCopy(person(),0,2,other_Person(),0)
    Format:
    You will need to treat differently the whole part and the fraction part.
    Code:
    Sub App_Start
        
    Msgbox(SpecialFormat(1.2345678)) 'will display 001.235
    End Sub

    Sub SpecialFormat(num)
        frac = Format(num - Int(num),
    "F3")
        
    Return Format(Int(num),"d3") & SubString(frac,1,StrLength(frac)-1)
    End Sub
     
  3. Bruno

    Bruno Member Licensed User

    Thanks Erel,

    PS: Very useful Basic4PPC !!!!
     
Loading...
  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