Results 1 to 8 of 8

Thread: Formatting Text Box

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    55

    Formatting Text Box

    hello, well i want to format a text box called txtdis.text

    the contents of this will be prices so for e.g 3.25 and so on

    but it ends up going further in and comes out with an output of 3.25675 and so on.

    How can i cut this to make it a 2 decimal place figure like normal cash

    cheers

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    txtdis = format(myValue, "#0.00")
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    55
    whats the myvalue bit

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    just a variable
    could be 3.25675 or whatever
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    55
    the items that will be in txtdis will be the values coming out of a list box, like items in the list box will be prices, when they go into the textbox its all multiple decimil placed. :/

    so what would the variable be :/ sorryy im a newb1e only been programming for 3 months

  6. #6
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    with no code to hand, it has to be along the lines of :

    Textbox1.text = format(listview1.SelectedItems.Item(0).text, "##0.00")

    thats just playing with objects and properties and in theory selects the first item i.e. item(0) and trys to display it as a decimal number, with two decimal places

    Are you not alllowed to do research where you are, because if so you will struggle and this forum is better placed to pose really hard questions, which we all have suffered from

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    55
    can you tell me a newbie helper place then i went to google and wrote vb forums and this place showed up it has been a great help though

  8. #8
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    msdn is a god place to start

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width