Solved

DBGRID Col and Row

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now