Results 1 to 7 of 7

Thread: Making program look professional?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Question Making program look professional?

    Hey, I'm wanting to make my program look more professional & USERPROOF! Here's what I want to do:

    The following code populates a listview. I want to have another form with a progress bar that progresses as the list populates, while locking the form the listview is on so the user can't mess with it. Then when the progress bar reaches 100%, that form should close and turn vbModal off so the user can use the main form again. Hope this makes sense. I've never done this so I'm unsure on how to implement it. Any help is extremely appreciated.

    I need the progress bar form to be on while the following event is occuring:
    VB Code:
    1. For x = 0 To File1.ListCount - 1
    2.     fname = File1.Path & "\" & File1.List(x)
    3.     'Get the MP3 info
    4.     ReadID3Info fname 'Read Id3v1.1 information
    5.     CMp3info.FileName = fname 'Get mp3info such as bitrate
    6.     Set i = ListView1.ListItems.Add(, , File1.List(x))
    7.     i.SubItems(1) = RTrim(GetID3.Artist)
    8.     i.SubItems(2) = RTrim(GetID3.Songname)
    9.     i.SubItems(3) = RTrim(GetID3.Album)
    10.     i.SubItems(4) = RTrim(GetID3.Track)
    11.     i.SubItems(5) = RTrim(GetID3.Genre)
    12.     i.SubItems(6) = Format(FileLen(fname) / 1000000, "#0.00")
    13.     i.SubItems(7) = CMp3info.Frequency
    14.     i.SubItems(8) = CMp3info.BitRate
    15.         strMins = Format(CMp3info.Duration \ 60, "#0")
    16.         strSecs = Format(CMp3info.Duration Mod 60, "0#")
    17.         strLength = strMins & ":" & strSecs
    18.     i.SubItems(9) = strLength
    19.     i.SubItems(10) = fname
    20. DoEvents
    21. Next

  2. #2
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    assuming you want a zero to 100 progress bar, do this

    VB Code:
    1. frmProgress.Show    ' or load it modal if that's what you want
    2. frmProgress.ProgressBar1.Value = 0
    3. For x = 0 To File1.ListCount - 1
    4.     fname = File1.Path & "\" & File1.List(x)
    5.     'Get the MP3 info
    6.     ReadID3Info fname 'Read Id3v1.1 information
    7.     CMp3info.FileName = fname 'Get mp3info such as bitrate
    8.     Set i = ListView1.ListItems.Add(, , File1.List(x))
    9.     i.SubItems(1) = RTrim(GetID3.Artist)
    10.     i.SubItems(2) = RTrim(GetID3.Songname)
    11.     i.SubItems(3) = RTrim(GetID3.Album)
    12.     i.SubItems(4) = RTrim(GetID3.Track)
    13.     i.SubItems(5) = RTrim(GetID3.Genre)
    14.     i.SubItems(6) = Format(FileLen(fname) / 1000000, "#0.00")
    15.     i.SubItems(7) = CMp3info.Frequency
    16.     i.SubItems(8) = CMp3info.BitRate
    17.         strMins = Format(CMp3info.Duration \ 60, "#0")
    18.         strSecs = Format(CMp3info.Duration Mod 60, "0#")
    19.         strLength = strMins & ":" & strSecs
    20.     i.SubItems(9) = strLength
    21.     i.SubItems(10) = fname
    22.     DoEvents
    23.     frmProgress.ProgressBar1.Value = 100 * (x / (File1.ListCount - 1))
    24. Next x
    25. unload frmProgress

  3. #3
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    forgot to mention, set progress bar min to 0 and max to 100 (these are in the properties at design time, and are available at run-time as well)

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    The problem with having a modal form show the progress of a process on an other form is that when you call
    VB Code:
    1. frmProgress.Show vbModal
    the code on the other form will stop dead in it's tracks until you close the modal form.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Two questions.........

    Instead of using vbModal could I use that freeze window API? That just freezes the window allowing code to run in the background.

  6. #6
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    MarkT's point is certainly a good one. I don't know anything about the "freeze window" thing, but I have another off-the-cuff idea which is this. Don't make the progress form modal, but while it's running, make the other form have .enabled=false

    I'm not sure that works but the idea would be to allow your code to keep running but not allow user input of any kind to the form while the progress bar is on.

  7. #7
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brugge, Belgium
    Posts
    208
    You could also add the progress bar to the form itself instead of having another form open and set the enable property of the listview to false.

    I think this will look more professional and user-friendly.

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