Solved

datacombo on the datagrid (help)...urgent

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…

813 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