ReadLn In VB

Discussion in 'Programming General' started by Jukka, Nov 8, 2007.

ReadLn In VB
  1. Unread #1 - Nov 8, 2007 at 11:33 AM
  2. Jukka
    Joined:
    Nov 23, 2005
    Posts:
    244
    Referrals:
    0
    Sythe Gold:
    0

    Jukka Active Member

    ReadLn In VB

    Question 1)
    In scar when i want the user to enter a number i do:

    String := ReadLn('Enter text or numbers');

    What readln does is it pops up a box which then has the entered text. It returns the answer you give when you press OK, to the string.

    What im asking is:

    How would i do a this simple statement in Visual basic 6.0?

    ------------------
    Question 2)
    In scar to return a random number i do: Random(1000) it then returns a random integer.

    How do i do this in Visual basic 6.0?
     
  3. Unread #2 - Nov 8, 2007 at 1:04 PM
  4. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    ReadLn In VB

    Q1:

    InputBox

    Q2:

    Rnd
     
  5. Unread #3 - Nov 8, 2007 at 1:26 PM
  6. Jukka
    Joined:
    Nov 23, 2005
    Posts:
    244
    Referrals:
    0
    Sythe Gold:
    0

    Jukka Active Member

    ReadLn In VB

    Another question:

    In scar i would do
    StrToInt
    Which stands for: String To Integer

    Is there anything like that in VB?
     
  7. Unread #4 - Nov 8, 2007 at 1:51 PM
  8. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    ReadLn In VB

    Val()
     
  9. Unread #5 - Nov 8, 2007 at 2:38 PM
  10. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    ReadLn In VB

    Int()
    Str()
     
  11. Unread #6 - Nov 8, 2007 at 3:03 PM
  12. Jukka
    Joined:
    Nov 23, 2005
    Posts:
    244
    Referrals:
    0
    Sythe Gold:
    0

    Jukka Active Member

    ReadLn In VB

    Ty ;) I googled it, so.. i got it a little faster x_O
     
  13. Unread #7 - Nov 8, 2007 at 3:31 PM
  14. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    ReadLn In VB

    As TerranKiller said using Int() and Str() is faster and more effective because then VB knows what type of value it is parsing.

    The Val() function is slower in the same way that using Variants is slower than String and Integer functions.
     
  15. Unread #8 - Nov 9, 2007 at 12:10 AM
  16. 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

    ReadLn In VB

    wrong.....
    val() does a string to double, there are no variants involved....
     
  17. Unread #9 - Nov 9, 2007 at 8:51 AM
  18. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    ReadLn In VB

    I didn't say it used Variants. I said it's slower IN THE SAME WAY that variants are slower than integers/strings meaning that it's just to do with weird VB6 variable/function preference. In the same way VB6 will sometimes lag like hell looping through integers but use long variables in your loops and it should run perfectly smooth.
     
< I need help | Hiscores Lookup? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site