Solved

DBGRID Col and Row

Posted on 2002-07-26
4
805 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

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

14 Experts available now in Live!

Get 1:1 Help Now