Solved

Populate list Items in DBGRID list

Posted on 2001-06-26
3
152 Views
Last Modified: 2010-05-02
I have inserted a button in a column of a grid

dbgrid1.columns(1).button=true
Now the button is displayed
Can anybody give me a sample code for the Button_click event for this?
Thank you!
Thakurdesai
0
Comment
Question by:thakurdesai
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6230341
This example is used to make a datacombo appear in the cell when the button is clicked. You can use any other control in this situation, a list box or combo or whatever.

Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
' Assign the Column object to Co because it will be used
  ' more than once.
  Dim Co As Column
   
  Set Co = DBGrid1.Columns(ColIndex)
   
  ' Position and drop down list1 at the right edge of the
  ' current cell.
  DataCombo1.Left = DBGrid1.Left + Co.Left + Co.Width
  DataCombo1.Top = DBGrid1.Top + DBGrid1.RowTop(DataGrid1.Row)
  DataCombo1.Visible = True
  DataCombo1.ZOrder 0
  DataCombo1.SetFocus
End Sub

Private Sub DBGrid1_Scroll(Cancel As Integer)
' Hide the list if we scroll.
  DataCombo1.Visible = False
End Sub

Private Sub List1_Click()
  'Update the appropriate field in the record.
  DataCombo1.Visible = False
End Sub

When the button is clicked, the data combo is displayed next to the field. Choosing an item
from the list will then update the record (you need to put in the appropriate code for this) and hide the datacombo
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7139843
Hi thakurdesai@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept TimCottee's comment(s) as an answer.

thakurdesai@devx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7178875
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question