Solved

datacombo on the datagrid (help)...urgent

Posted on 2000-03-08
2
179 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 60 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

765 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