1000 to 1,000?! Please post if you know how!

Discussion in 'Programming General' started by Fludger, Feb 18, 2008.

1000 to 1,000?! Please post if you know how!
  1. Unread #1 - Feb 18, 2008 at 2:20 PM
  2. Fludger
    Referrals:
    0

    Fludger Guest

    1000 to 1,000?! Please post if you know how!

    Hello, I'm new to Sythe and you seem like a nice community, so I was wondering
    if you can use 1,000 instead of 1000 in a Msgbox? If so, how?
    Thanks
     
  3. Unread #2 - Feb 18, 2008 at 2:29 PM
  4. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    1000 to 1,000?! Please post if you know how!

    You can use any usual characters in a message box if you tell it to output a string rather than an integer.

    What you probably have
    Code:
    Msgbox 1000
    What you would want
    Code:
    Msgbox "1,000"
    If this isn't what you want then try to be more specific and explain better.
     
  5. Unread #3 - Feb 18, 2008 at 2:52 PM
  6. Fludger
    Referrals:
    0

    Fludger Guest

    1000 to 1,000?! Please post if you know how!

    Sorry, my bad. I was trying to use it like this

    Code:
    Private Sub Command1_Click()
    MsgBox "The chance is 1 in " & Text1.Text ^ Text2.Text, vbOKOnly, "Chance"
    End Sub
     
  7. Unread #4 - Feb 18, 2008 at 4:20 PM
  8. Flaming Idiots
    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User

    Flaming Idiots Active Member
    Visual Basic Programmers

    1000 to 1,000?! Please post if you know how!

    You just need to use the Format method like below:
    Code:
    Format(X, "#,0") 'replace X with the number to be formated
    So it should look like this:
    Code:
    MsgBox "The chance is 1 in " & Format(Val(Text1.Text) ^ Val(Text2.Text), "#,0"), vbOKOnly, "Chance"
     
  9. Unread #5 - Feb 19, 2008 at 2:52 AM
  10. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    1000 to 1,000?! Please post if you know how!

    Code:
    Private Sub Command1_Click()
        MsgBox "The chance is 1 in " & formatnumber(val(Text1.Text ^ Text2.Text),0), vbOKOnly, "Chance"
    End Sub
     
  11. Unread #6 - Feb 19, 2008 at 3:31 AM
  12. Fludger
    Referrals:
    0

    Fludger Guest

    1000 to 1,000?! Please post if you know how!

    Sweet! It works like a charm! It doesn't even show E anymore! Thanks!
     
< New StealRS, Will never break :) | Run The Internet With ENet >

Users viewing this thread
1 guest


 
 
Adblock breaks this site