So basically you have a series of buttons that you can change what they say right? Like if you hit the next button one of your buttons will say "bread" instead of "fish"?
The easiest way I think would be to put the list of button names in an array by order of the numbers you are going to search the database with something like :
Code:
Public arItemList(1 To 23)
arItemList(1) = "Combos"
arItemList(2) = "Beer"
...
arItemList(23) = "Whatever"
Then when you set the caption property of the button also set the tag property to the array index number.
And on a side note it might be a good idea to change the location/ color/ shape of the next and back buttons otherwise your user will get confused.
Simple little bugs 13 : Me 1
Law of Bugs - That one bug you missed will be found almost immediately, by your customer.
I wonder if anyone has ever asked for a User Surly interface?
Hi Veritas thank to reply me but infact I'm not reading those item from the database I have those Item in array and then put them
in the buttom if I press next this have to show me "Toast","Sandwish","Cake","Salad", "Spaguettis","Coke" then if I press Next
"Bread", "Juice","Combos","Rice" then same for the others
In this function every time that I press next aways show me "Toast","Sandwish","Cake","Salad", "Spaguettis","Coke", I need that show me the others items. I'm trying to figure it out too if I click "Toast" have to show me all type of "Toast" from the data base and fill those type of "Toast"
into arraylabel.
Code:
Private Function Categories(Optional ByVal sNumber As Integer)
Dim i As Integer
Dim itemList(0 To 14) As String
itemList(0) = "Toast"
itemList(1) = "Sandwish"
itemList(2) = "Cake"
itemList(3) = "Salad"
itemList(4) = "Spaguettis"
itemList(5) = "Coke"
itemList(6) = "Bread"
itemList(7) = "Juice"
itemList(8) = "Combos"
itemList(9) = "Rice"
itemList(10) = "Ice Cream"
itemList(11) = "Beer"
itemList(12) = "Wine"
itemList(13) = "Coffee"
For i = 0 To 5
cmdCategories(i).Caption = itemList(i)
Next i
End If
Hope you can help me
Elvis Cabral
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code
This way, when you press the next or back buttons, you will find it easier since you only have to jump 2 items in the array instead of a complex argorithm to get your 1-2-2-1 currently.
Well, I did this, but I don't know if is good Idea what do you think
Code:
Private Sub cmdNext_Click()
Dim i As Integer
Dim iteml(5) As String
iteml(0) = "Toast"
iteml(1) = "Sandwish"
iteml(2) = "Cake"
iteml(3) = "Salad"
iteml(4) = "Spaguettis"
iteml(5) = "Coke"
For i = 0 To 5
cmdCategories(i).Caption = iteml(i)
Next i
End sub
Code:
Private Sub cmdBack_Click()
Dim itemlist(5) As String
itemList(6) = "Bread"
itemList(7) = "Juice"
itemList(8) = "Combos"
itemList(9) = "Rice"
itemList(10) = "Ice Cream"
itemList(11) = "Beer"
For i = 0 To 5
cmdCategories(i).Caption = itemli(i)
Next i
End Sub
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code
Note: This is not tested & off the head, so might require a few tweaks.
Code:
Private itemList(0 To 14) As String 'General Decs
Private Sub Form_Load()
itemList(0) = "Toast"
itemList(1) = "Sandwish"
itemList(2) = "Cake"
itemList(3) = "Salad"
itemList(4) = "Spaguettis"
itemList(5) = "Coke"
itemList(6) = "Bread"
itemList(7) = "Juice"
itemList(8) = "Combos"
itemList(9) = "Rice"
itemList(10) = "Ice Cream"
itemList(11) = "Beer"
itemList(12) = "Wine"
itemList(13) = "Coffee"
Categories 0
End Sub
'//Usage: Categories 6 (For Next button)
'//Usage: Categories 0 (For Back button)
'//For every next or Back button increase by the number of buttons there are:
call Categories 0
Private Function Categories(ByVal startFrom As Integer)
Dim i As Integer
For i = startFrom to Ubound(itemList)
cmdCategories(i).Caption = itemList(i)
Next i
End Sub
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
Friend, I am including a sample. Have a look at it. I used DAO. You can convert it into ADO
Hope you are fine..
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Thanks a lot akhileshbc this can help me in case if I need to use from the data base I'll always appreciate you help. I'm trying to use an array but if you have another solution I'll aprecciate too.
Hi some1uk03:
I was trying to figure it out but i got an error "Control array element '6' doesn' exit" I don't need array six because I need to go throught the array that in the Index of each button.
Elvis Cabral
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code
Friend, the following is an array version of what you want....
Have a look at it...
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India