Results 1 to 6 of 6

Thread: [RESOLVED] Develoment Queries

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Resolved [RESOLVED] Develoment Queries

    Hi!
    please find the word document as enclosed.
    in that word document you fill find all the scenarios which i have taken as a snapshot.
    i have a combobox and im displaying all the columns in that combobox.
    you have 3 options here 1) Supress 2) Lock 3) Hide.
    now i want to store these information because when the user switches to another column it should display its status.
    now to store information of these columns.
    i dont want to save this in database since its not necessary.
    can i use a structure to store information or what should i do in storing the information.
    if im using stucture then i have 7 columns & 3 states(supress,hide,lock) so 7*3 =21 variables or like how to do this easily.

    pls help me in this regard.
    i just need some develoment solutions for this.
    what best i can use in order to store information.
    with regards!
    Sethuraman R
    Attached Files Attached Files

  2. #2
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: Develoment Queries

    try this, add a combo,listbox,command button
    Code:
    Dim Myvar()
    Dim i, j As Integer
    
    Private Sub Command1_Click()
    List1.Clear
    For j = 0 To i - 1
        List1.AddItem Myvar(j)
    Next
    i = 0
    End Sub
    
    Private Sub Form_Load()
    Combo1.AddItem "a"
    Combo1.AddItem "b"
    Combo1.AddItem "c"
    Combo1.AddItem "d"
    
    For i = 0 To Combo1.ListCount - 1
        ReDim Preserve Myvar(i)
        Myvar(i) = Combo1.List(i) 'storing values
    Next
    End Sub
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Arrow Re: Develoment Queries

    Hi!
    Thanks for the code but how to display the previous saved state.
    have a look at the word doucment as enclosed in my previous post.
    first i will select description from the combobox and will apply the hide check box &then i will select the next column say uom in the combobox and then apply the lock option for this column.
    now if i again select the first column say description then the option hide should be cheked.
    i.e how to maintain the previous state...

    pls help me in this regard.
    with regards!
    Sethuraman R

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Develoment Queries

    One easy way is to use bitwise operations
    Supress=1:Hide=2:Lock=4
    Each time one of the checkboxes are clicked, update the itemdata for the combobox item...

    I don't know if your checkboxes are arrayed or each is an individual control name. I will assume the former. Adjust code as needed for control names
    Code:
    Private Sub chkOptions_Click(Index As Integer)
         ' each check box is indexed: 0, 1, 2
         ' update the itemdata to the new options
         Dim lOptions As Long
         if cboItems.Tag = "no update" Then Exit Sub ' see cboItems_Click()
         If cboItems.ListIndex = -1 Then Exit Sub
         lOptions = cboItems.ItemData(cboItems.ListIndex)
         Select Case Index ' toggle options
         Case 0 ' suppress
             lOptions = lOptions Xor 1
         Case 1 ' hide
             lOptions = lOptions Xor 2
         Case 2 ' lock
             lOptions = lOptions Xor 4
         End Select
         cboItems.ItemData(cboItems.ListIndex) = lOptions
    End Sub
    
    Private Sub cboItems_Click()
         Dim lOptions As Long
         cboItems.Tag = "no update" ' prevent checkboxes from updating itemdata
         lOptions = cboItems.ItemData(cboItems.ListIndex)
         chkOptions(0).Value = (lOptions And 1) ' supress
         chkOptions(1).Value = (lOptions And 2) \ 2 ' hide
         chkOptions(2).Value = (lOptions And 4) \ 4 ' lock
         cboItems.Tag = ""
    End Sub
    Edited: If you are already using the itemdata property of the combobox items, then an array would be a good alternative.
    Last edited by LaVolpe; Sep 15th, 2009 at 04:07 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Arrow Re: Develoment Queries

    Hi!
    Great piece of work..
    it works fine Thanks a lot

  6. #6
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: [RESOLVED] Develoment Queries

    lavolpe its realy good, can u pls explain me how this code works especialy itemdata
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


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