Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Unanswered: how to get numbers to show?

    hi, i am trying to get a program that displays how many letters you have typed into a text box, but i am unfamiliar with the "dim" command ect. so i was hoping someone can help me, i will attatch my code in a .txt,
    i am not sure how to get the integer to go up 1 everytime you type, or should i be using a variable instead??

    thanks in advance,

    Hoy145
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    It's a scope issue. You DIMMED x within the Form_Load sub. This means that x isn't available anywhere outside this sub.

    Since you want to access x in several different subs within the form, declare it (DIM) at the FORM level (before any subs or functions.)

    Now, you increment x every time you make a change to the text in the textbox. Suppose you have already entered db.com (and x is equal to 6.) What happens when you press the backspace key? What happens if you highlight all the text in the textbox, and press the delete key?

    VB has a built-in function which returns the length of a string... it's called LEN. You might find it useful.
    Last edited by loquin; 07-01-09 at 20:59.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Jun 2009
    Posts
    4

    Thanks

    ahh thank you ,
    i'll try the LEN command now, i wondered where i had gone wrong, but i expected to as i have only just started,
    thanks again,
    Hoy145

  4. #4
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Just remember to not declare a variable at any higher scope level than it needs to be.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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