Results 1 to 13 of 13

Thread: [RESOLVED] Search using a bottom

  1. #1

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Resolved [RESOLVED] Search using a bottom

    Hi!

    I need if you can help me


    I have arraybuttom to show items but I need to search by categories:

    For example:

    If I Click "Coffee" this have to show me just coffee and the same for
    the others Categories: "Combos","Beer","Coffee","Coke","Pastas","Sandwish"

    I show those items in 23 an LabelsArray


    I have two bottom too "Back" and "Next" if Press Next I have to show more categories:
    "Bread", "Rice", "Juice", "Cake".

    The Id for this items in the data base:

    Combos = 1
    Beer = 2
    Coffee = 3
    Pastas = 4
    Sandwish = 5
    Bread = 6
    Rice = 7
    Juice = 8
    Cake = 9

    I'm Using ADO

    Elvis Cabral
    Attached Images Attached Images  
    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

  2. #2
    Addicted Member Veritas2.0's Avatar
    Join Date
    May 2008
    Posts
    181

    Re: Search using a bottom

    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?

  3. #3

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Search using a bottom

    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

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Search using a bottom

    What is the code in your Next button?

    Also, how are you going "Back"?

  5. #5

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Search using a bottom

    I'm confuse I don't know what to set in the next buttom and the back buttom please help
    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

  6. #6
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: Search using a bottom

    Just an idea, but perhaps if you arrange the buttons, and have them into a control array, you'll find it easier to understand the concept and code it:

    Please pardon the cheap Ascii art.

    [BUtton(0)] [Button(2)] [Button(4)] [Button(6)]
    [Button(1)] [Button(3)] {Button(5)] [Button(7)]
    [BtnBck]---------------------------[BtnFwd]

    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.

  7. #7

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Search using a bottom

    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

  8. #8
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: Search using a bottom

    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.



  9. #9
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Search using a bottom

    Friend, I am including a sample. Have a look at it. I used DAO. You can convert it into ADO

    Hope you are fine..
    Attached Files Attached Files

    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


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  10. #10

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Search using a bottom

    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

  11. #11
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Question Re: Search using a bottom

    Friend, the following is an array version of what you want....

    Have a look at it...
    Attached Files Attached Files

    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


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  12. #12

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: [RESOLVED] Search using a bottom

    Thanks a lot my friend akhileshbc

    Finally my application is running perfect!

    Thanks for you help

    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

  13. #13
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: [RESOLVED] Search using a bottom

    You are always welcome

    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


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

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