Results 1 to 3 of 3

Thread: Left function

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Posts
    416

    Left function

    Hi,

    In VB.NET, to use the Left function to extract characters from a string, I need to write:

    Microsoft.VisualBasic.Strings.Left(strSomething, 5)

    if just Left(strSomething, 5), it will points to Left of another Class.

    This problem does not occur however for Mid() and Right() function.

    Is there any way to eliminate this problem?

    Thx~

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Left function

    Those are old VB6 functions. Now we tend not to use them.

    The Left you referred to is most likely the Left property of the Form you are working on, which will return an integer defining the horizontal position of the left edge of the form.

    Lets say you want to grab the first 7 characters from "Hello World"...

    MyString = "Hello World"
    MyOtherString = Mystring.Substring(0,7)
    'myotherstring now holds "Hello W"
    I don't live here any more.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Left function

    In my projects, I always remove the Microsoft.VisualBasic namespace from the imports list (see the project properties dialog) and use Option Strict On for all my code.

    These measures ensure better coding practices.
    I don't live here any more.

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