Results 1 to 6 of 6

Thread: How to use Left(String, Length as long)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    87

    Question

    I know how to associate my program with a file-format in the registry but I don't know how to open the file in VB6. I think I need to use left(string, lenght as long) in the Sub Main but I have no idea how I should do it. Can somebody help me please???!!!

    ThAnX

  2. #2
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Question

    I'm not quite getting what you want to do.

    Do you want to create a buffer, add text, and then trim it back down?

    If that's what you want to do, here's how to do it:
    Code:
    Dim Buffer As String
    Buffer = Space$(256) 'Add 256 spaces
    'Modify Buffer the way you want to
    Buffer = Trim$(Buffer) 'Remove spaces
    Is this what you want?

    Courgettes.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    87
    OK maybe I wasn't clear enough with my question, I'll try it again.

    When you click for example a vb project-file in explorer vb will be loaded and the project file will be opened. Well, that's what I want to do, when someone clicks a file with my extension I want it to be opened with my program. I already know how to add the extension to the registry and send a command to my program but I don't know how to load the clicked file. The only thing that happens is my program that loads and the file I clicked is not opened.

    I hope this is a little bit more clear.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use the Command$ function, it will return all command parameters, (separated with space so you could use split function to split them up) therfore when you click command will return the filename(s)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    87

    Unhappy

    Thanx but I don't realy understand it (I'm just a beginner). Could you please send me a clear example code, please...

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here's an example, should enumerate all Filenames in the For Each loop.
    Code:
    Private Sub Form_Load()
    Dim Filenames, Filename
        Filenames = Split(Command, " ")
        For Each Filename In Filenames
            MsgBox Filename
        Next Filename
    End Sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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