Adblock breaks this site

ReadLn In VB

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

  1. Jukka

    Jukka Active Member

    Joined:
    Nov 23, 2005
    Posts:
    244
    Referrals:
    0
    Sythe Gold:
    0
    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?
     
  2. Terrankiller

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1
    ReadLn In VB

    Q1:

    InputBox

    Q2:

    Rnd
     
  3. Jukka

    Jukka Active Member

    Joined:
    Nov 23, 2005
    Posts:
    244
    Referrals:
    0
    Sythe Gold:
    0
    ReadLn In VB

    Another question:

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

    Is there anything like that in VB?
     
  4. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    ReadLn In VB

    Val()
     
  5. Terrankiller

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1
    ReadLn In VB

    Int()
    Str()
     
  6. Jukka

    Jukka Active Member

    Joined:
    Nov 23, 2005
    Posts:
    244
    Referrals:
    0
    Sythe Gold:
    0
    ReadLn In VB

    Ty ;) I googled it, so.. i got it a little faster x_O
     
  7. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    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.
     
  8. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    ReadLn In VB

    wrong.....
    val() does a string to double, there are no variants involved....
     
  9. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    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? >


 
 
Adblock breaks this site