Results 1 to 5 of 5

Thread: come on guys, don't let me down

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Can't anyone help me?

    How do I use the DBGrid's button property? The help that I have just says:
    Typically, you enable the column button when you want to drop down a control (such as the built-in combo box, a bound list box, or even another DBGrid control) for editing or data entry. When the button in the current cell is clicked, the ButtonClick event will be fired. You can then write code to drop down the desired control from the cell.

    It doesn't give me an example or anything else on how to do this. Can someone help with this?


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Add an Invisible Listbox to the Form with some List Items in it and set the Appearance to Flat..
    Code:
    Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
        With DBGrid1.Columns(ColIndex)
            List1.Move DBGrid1.Left + .Left + 20, DBGrid1.Top + .Top + ((DBGrid1.Row + 1) * DBGrid1.RowHeight) + 230, .Width
            List1.Visible = True
            List1.SetFocus
        End With
    End Sub
    
    Private Sub List1_Click()
        DBGrid1.Text = List1
        List1.Visible = False
    End Sub
    
    Private Sub List1_LostFocus()
        List1.Visible = False
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Thanks Aaron. That did the trick. It works the same way to use combo boxes? What would be the best way to use a check box? The same way?

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Sure, you just have to position the Control over the Selected Cell and make sure any selection is transferred back to the cell value.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Cool. Thanks again

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