PDA

Click to See Complete Forum and Search --> : Best way to build this app


timmyc123
Jul 27th, 2008, 07:54 PM
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

dclamp
Jul 27th, 2008, 08:21 PM
how do you want to store the items? text file or database?

Shaggy Hiker
Jul 27th, 2008, 08:24 PM
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.

timmyc123
Jul 27th, 2008, 08:57 PM
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

Shaggy Hiker
Jul 27th, 2008, 09:17 PM
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:

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.