Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Populate list Items in DBGRID list

Posted on 2001-06-26
3
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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