Solved

datacombo on the datagrid (help)...urgent

Posted on 2000-03-08
2
173 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 69

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

762 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

18 Experts available now in Live!

Get 1:1 Help Now