Solved

DBGRID Col and Row

Posted on 2002-07-26
4
804 Views
Last Modified: 2012-06-21
How do you determine cell, data DBgrid ?
For example if I press enter
in one off many cell in bound grid
then how do i know it's row and it's col.
And How to place a combo to Dbgrid without
third party (Just using trick)
0
Comment
Question by:ekohartono
4 Comments
 
LVL 10

Expert Comment

by:aeklund
ID: 7180266
You can use this to determine which cell and row you are currently in:

Private Sub DBGrid1_KeyPress(KeyAscii As Integer)
  Debug.Print DBGrid1.Col
  Debug.Print DBGrid1.Row
End Sub

0
 
LVL 4

Expert Comment

by:gencross
ID: 7180279
In the cell change event use...

lCol = grddatagrid.Col
lRow = grddatagrid.Row

I don't think you are going to be able to place a combo in the dbgrid.  What exactly are you trying to do?
0
 

Author Comment

by:ekohartono
ID: 7180308
thank you for the answer guys.....

date | code | Item | price | total |

in code column i wanna place a combo so just choose  a list of code hope this helps
0
 
LVL 2

Accepted Solution

by:
yongyih earned 50 total points
ID: 7180312
I do this using MSFlexGrid.  May be you can apply it in DGGrid

Sub setTextBox()
    With txtGridData
      .Visible = True
      .Top = listOfSales.Top + listOfSales.CellTop
      .Left = listOfSales.Left + listOfSales.CellLeft
      .Width = listOfSales.CellWidth
      .Height = listOfSales.CellHeight
    End With
End Sub


Private Sub listOfSales_Click()
  setTextBox
End Sub


Private Sub txtGridData_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        listOfSales.TextMatrix(listOfSales.Row, listOfSales.Col) = txtGridData.Text
        txtGridData.Visible = False
    End If
End Sub

Hope this can help. Good luck.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

895 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

13 Experts available now in Live!

Get 1:1 Help Now