Select file names
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Select file names

  1. #1
    Join Date
    Jul 2004
    Posts
    84

    Lightbulb Select file names

    Hi everyone. I'm using a common dialog control to select filenames. The problem is that they must have multiple selection option.

    When I try to parse the FileName property I get this weird character "" I dunno what to use to compare this special character. The code follows

    files = dlgSelArchivo.FileName
    n = Len(files)
    For j = 1 To n
    char = Mid(files, j, 1)
    If char = Null Then
    flag = 1
    ElseIf char <> Null And flag >= 1 Then
    final = final + char
    ElseIf char = Null And flag >= 1 Then
    final = final + "; "
    End If
    Next j

    Any replies will be appreciated.

    Thank You

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726
    If char = Null Then
    this is not fine in Vb6
    you must code differently:
    suppose char is a variant, you can code:
    if isEmpty(char) then
    in case you did not assigned anithing
    or
    if isNUll(char) then
    in case you read from a db a null field
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jul 2004
    Posts
    84
    Thanx cimperiali. I'll try that

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332
    Seems to me all that code can be replaced by something like this:
    Files = Replace(Files, Chr(1), "; ")
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  5. #5
    Join Date
    Jul 2004
    Posts
    84
    Well, it didn't work , but I found another way around. I used vbCharNull instead of IsEmpty and it worked

    Sometimes MSDN isn't as bad as it looks

    Anyway, thanx Cimperiali

  6. #6
    Join Date
    Jul 2004
    Posts
    84
    Oh... I was just editing the post and hadn't read your reply WizBang. I think I'll try that

    Thanx

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center