Solved

grid cols & combo boxes

Posted on 2000-04-18
2
118 Views
Last Modified: 2010-05-02
I want to turn one of my flexgrid columns into a listbox. How do I do it ?
0
Comment
Question by:ahmad_zaman
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 10 total points
ID: 2726435
Set DataGrid.Columns(n).Button = True

Then

Private Sub DataGrid1_BeforeColEdit(ByVal ColIndex As Integer, ByVal KeyAscii As Integer, Cancel As Integer)
' BeforeColEdit is called before the grid enters into
    ' edit mode.  You can decide what happens and whether
    ' standard editing proceeds.  This allows you to
    ' substitute different kinds of editing for the current
    ' cell, as is done here.

    If ColIndex = n Then
        ' Let the user edit by entering a key.
        If KeyAscii <> 0 Then Exit Sub
       
        ' Otherwise, cancel built-in editing and call the
        ' ButtonClick event to drop down list1.
        Cancel = True
        DataGrid1_ButtonClick (ColIndex)
    End If
 End Sub

Private Sub DataGrid1_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 = DataGrid1.Columns(ColIndex)
     
    ' Position and drop down list1 at the right edge of the
    ' current cell.
    List1.Left = DataGrid1.Left + Co.Left + Co.Width
    List1.Top = DataGrid1.Top + DataGrid1.RowTop(DataGrid1.Row)
    List1.Visible = True
    List1.ZOrder 0
    List1.SetFocus

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

End Sub

Should get you started.


0
 

Author Comment

by:ahmad_zaman
ID: 2793701
thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now