[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

datacombo on the datagrid (help)...urgent

Posted on 2000-03-08
2
Medium Priority
?
188 Views
Last Modified: 2010-05-02
i want to move the datacombo(it is on the 3rd col on the datagrid) on the col up and down,and it should appear only on the cell which is clicked by the user otherwise it should remain visible false
datagrid is connectd to a table thru adodc
i am tried the following code
DataGrid_mousedown event
If DataGrid1.ColContaining(X) = 4 Then
   'Dim DY, DX, RowValue, ColValue, CellLeft, CellTop
    ColValue = DataGrid1.ColContaining(X)
    RowValue = DataGrid1.RowContaining(Y)
    'Get the height of the cell.
    DY = DataGrid1.RowHeight
    'Get the width of the cell.
    DX = DataGrid1.Columns(ColValue).Width
    CellLeft = DataGrid1.Columns(ColValue).Left
   
    CellTop = DataGrid1.RowTop(RowValue)
   
    CellLeft = CellLeft - DataGrid1.RowHeight
    DataCombo1.Left = DataCombo1.Left + CellLeft - 1050
    DataCombo1.Top = DataCombo1.Top + CellTop - 160
    DataCombo1.Width = 2865
    DataCombo1.Height = 315
    DataCombo1.Move DataCombo1.Left, DataCombo1.Top, DataCombo1.Width, DataCombo1.Height
    DataCombo1.Visible = True
 End If
0
Comment
Question by:bindu10
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 180 total points
ID: 2597263
Add a ListBox and make its visible property to False.


'Add this code to the form declaration

Option Explicit
Dim intColIdx As Integer
 'This will contain the index for the current  cell in the dbgrid
Dim blnListShow As Boolean 'is the list showing or not


Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
Dim intTop As Integer
intColIdx = ColIndex
If blnListShow = False Then 'if the list is not showing then...
blnListShow = True
List1.Left = DBGrid1.Columns(ColIndex).Left + 360
intTop = DBGrid1.Top + (DBGrid1.RowHeight * (DBGrid1.Row +2))
 List1.Top = intTop
 List1.Width = DBGrid1.Columns(ColIndex).Width + 15
                     List1.Visible = True
                  List1.SetFocus
Else 'if the list is show, hide it
             blnListShow = False
              List1.Visible = False
End If
End Sub


          Private Sub Form_Load()
                blnListShow = False 'initialize
           End Sub

        Private Sub List1_Click()
DBGrid1.Columns(intColIdx).Text = List1.Text
 'set the value of the dbgrid
  List1.Visible = False 'hide the list
        End Sub

                      Private Sub List1_LostFocus()
                          blnListShow = False
                          List1.Visible = False
                      End Sub
0
 

Author Comment

by:bindu10
ID: 2602944
thanxs emoreau,for your timely support
mathew
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

834 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