Results 1 to 5 of 5

Thread: Best way to build this app

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    3

    Best way to build this app

    Hello Everyone

    I'm fairly new to VB....

    I'm designing an app that shows upcoming items on an agenda...

    So in Big text in the middle of the app, it will have the current item
    then underneath that, it will have the 2 next items in the list...
    After clicking the "bump" button, the next item will move up, ect...

    What is the best way to go about this? I would to have a setup screen to enter the items in...

    Thanks in advance

    TIM

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Best way to build this app

    how do you want to store the items? text file or database?
    My usual boring signature: Something

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Best way to build this app

    Not quite sure what you are asking. Are you wondering what how you would store the items?

    It seems to me that you need one form to Add/Delete/Edit items in the list, then the main form would be the one with the three labels (at least it sounds like you are talking about three labels). So are you asking about how to store the items? If so, it seems like a Queue (of String) would be the way to go about it if items are to be added sequentially. If you would want to be inserting items into the middle of the list, etc., then a List (of String) would be better. If there is more than just a string that needs to be saved, then a class or structure to hold the items, and a list of that class would be the way to go.

    Beyond that, I think we would need a bit more specific a question.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    3

    Re: Best way to build this app

    text file would be fine...

    yes i'm having trouble storing an recalling


    how do I tell it to show "slot 1" in lbl1
    slot 2 in lbl2
    and slot 3 in lbl3

    and how to move everything up when i hit bump

    thanks

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Best way to build this app

    If you are using a text file to save everything (if you are looking for examples of that, search the .NET forum on the word ReadAllLines, and you will get loads of code examples), then you would almost certainly be reading into an array of strings, rather than a list. That's fine.

    I would suggest that you add one integer variable called something like Index. Then, if your array was called myArray, then the bump click event would look something like this:
    Code:
     Index+=1
     If Index > (myArray.GetUpperBound(0) - 2) then
      'Do something, because you've past the end of the array.
     Else
      lbl1.Text = myArray(Index)
      lbl2.Text = myArray(Index+1)
      lbl3.Text = myArray(Index+2)
     End if
    I may have a number wrong here (the -2 part on the upperbound), but it is close enough. There's a problem with the code anyways, because you can just keep pressing bump and the index will keep increasing. You probably don't want to do that, so you probably want to check to see whether you have reached the end of the array before you even allow the incrementing of Index.

    You would also be able to write almost the same thing to have a reverse button so that you could scroll up through the array as well. The only difference would be that you would be checking whether Index is 0, and stop decrementing the Index when you reach 0.

    That's a rough overview.
    My usual boring signature: Nothing

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