FLEXGRID EDITAVEL COM PROBLEMA
                    eu tenho um flexgrid editavel (que aceita editar os dados do BD nas celulas)
fiz um junção de um flexgrid com um textbox assim:
o problema é o seguinte
quando to numa celular e pulo para outra celula, ele leva o conteudo da celula anterior para a que cliquei...
se eu for descendo usando a setinha do teclado na mesma coluna funciona beleza
agora se eu tive na coluna 3 e for para a 4, ele traz o que tá na 3 e coloca na 4.... ficando a 3 e a 4 com o mesmo conteudo.
o que devo fazer?
                
            fiz um junção de um flexgrid com um textbox assim:
[ô]no general
Private iRow As Integer
Private iCol As IntegerPrivate Sub Grid_Click()
If Grid.ColSel = 4 Then
    [ô]ARMAZENO A LINHA CLICADA
    iRow = Grid.RowSel
    [ô]ARMAZENO A COLUNA CLICADA
    iCol = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
end if
end subPrivate Sub txtEdit_LostFocus()
Grid.TextMatrix(iRow, iCol) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
txtEdit.Visible = False
End Subo problema é o seguinte
quando to numa celular e pulo para outra celula, ele leva o conteudo da celula anterior para a que cliquei...
se eu for descendo usando a setinha do teclado na mesma coluna funciona beleza
agora se eu tive na coluna 3 e for para a 4, ele traz o que tá na 3 e coloca na 4.... ficando a 3 e a 4 com o mesmo conteudo.
o que devo fazer?
                    Testei o seu código e está funcionando corretamente. Verifique se você está usando as váriáveis iRow e iCol para outras rotinas. Neste caso, tenta substituir iCol pela coluna, já que é fixo. Aparentemente o problema está em outra parte do projeto.
Tente isso:
outra coisa é verificar o valor da iCol:
            Tente isso:
Private Sub txtEdit_LostFocus()
    Grid.TextMatrix(iRow, iCol) = IIf(TxtEdit.Text = [Ô][Ô], 0, TxtEdit.Text)
    TxtEdit.Visible = False
    iRow = 0
    iCol = 0
End Suboutra coisa é verificar o valor da iCol:
Private Sub txtEdit_LostFocus()
    If iCol <> 4 Then Exit Sub
    Grid.TextMatrix(iRow, iCol) = IIf(TxtEdit.Text = [Ô][Ô], 0, TxtEdit.Text)
    TxtEdit.Visible = False
    iRow = 0
    iCol = 0
End Sub
                
                    verifiquei e nao tõ usando essas variaveis em outro lugar nao:
fiz essas modificações agora:
ou seja, tenho varias colunas no grid para editar... então o problema é quando eu passo de uma para outra... de uma celula para outra na mesma linha... usando o mouse e o clique
            fiz essas modificações agora:
[ô]no general
Private iRow1 As Integer
Private iCol1 As Integer
Private iRow2 As Integer
Private iCol2 As Integer
Private iRow3 As Integer
Private iCol3 As Integer
Private iRow4 As Integer
Private iCol4 As Integer
Private iRow5 As Integer
Private iCol6 As IntegerPrivate Sub Grid_Click()
If Grid.ColSel = 4 Then
    iRow1 = Grid.RowSel
    iCol1 = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
ElseIf Grid.ColSel = 5 Then
    iRow2 = Grid.RowSel
    iCol2 = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
ElseIf Grid.ColSel = 6 Then
    iRow3 = Grid.RowSel
    iCol3 = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
ElseIf Grid.ColSel = 7 Then
    iRow4 = Grid.RowSel
    iCol4 = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
ElseIf Grid.ColSel = 8 Then
    iRow5 = Grid.RowSel
    iCol5 = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
ElseIf Grid.ColSel = 9 Then
    iRow6 = Grid.RowSel
    iCol6 = Grid.ColSel
    
    [ô]MOVO O TXTEDIT NA POSIÇÃO DA COLUNA X LINHA
    txtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
    txtEdit.Text = Grid.Text
    txtEdit.Visible = True
    txtEdit.SetFocus
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
End If
End Sub
Private Sub txtEdit_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 38 Then
    If Grid.Row - 1 = 0 Then MsgBox [Ô]VOCÊ Jà ESTà NA PRIMEIR LINHA !!![Ô], vbExclamation: Exit Sub
    Grid.Row = iRow - 1
    Grid.TextMatrix(iRow, iCol) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
    Grid_Click
ElseIf KeyCode = 40 Then
    If Grid.Rows = Grid.Row + 1 Then MsgBox [Ô]VOCÊ Jà ESTà NA ULTIMA LINHA !!![Ô], vbExclamation: Exit Sub
    Grid.TextMatrix(iRow, iCol) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
    Grid.Row = iRow + 1
    Grid_Click
End If
End SubPrivate Sub txtEdit_LostFocus()
If Grid.ColSel = 4 Then
    Grid.TextMatrix(iRow1, iCol1) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
ElseIf Grid.ColSel = 5 Then
    Grid.TextMatrix(iRow2, iCol2) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
ElseIf Grid.ColSel = 6 Then
    Grid.TextMatrix(iRow3, iCol3) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
ElseIf Grid.ColSel = 7 Then
    Grid.TextMatrix(iRow4, iCol4) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
ElseIf Grid.ColSel = 8 Then
    Grid.TextMatrix(iRow5, iCol5) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
ElseIf Grid.ColSel = 9 Then
    Grid.TextMatrix(iRow6, iCol6) = IIf(txtEdit.Text = [Ô][Ô], 0, txtEdit.Text)
End If
txtEdit.Visible = False
End Subou seja, tenho varias colunas no grid para editar... então o problema é quando eu passo de uma para outra... de uma celula para outra na mesma linha... usando o mouse e o clique
                    Ajustei o seu código neste projeto.
 
            [ô]em General
Dim iRow, iCol As Integer
Private Sub Form_Load()
    Grid.Rows = 10
    Grid.Cols = 10
End Sub
Private Sub Grid_Click()
    Dim i As Integer
    
    For i = 4 To 9
        If Grid.ColSel = i Then
            TxtEdit.Move Grid.Left + Grid.CellLeft, Grid.Top + Grid.CellTop, Grid.CellWidth, Grid.CellHeight
            TxtEdit.Text = Grid.TextMatrix(Grid.Row, Grid.Col)
            TxtEdit.Visible = True
            TxtEdit.SetFocus
            TxtEdit.SelStart = 0
            TxtEdit.SelLength = Len(TxtEdit.Text)
            iRow = Grid.Row
            iCol = Grid.Col
        End If
    Next i
End Sub
Private Sub txtEdit_KeyUp(KeyCode As Integer, Shift As Integer)
    Exit Sub
    If KeyCode = 38 Then
        If Grid.Row - 1 = 0 Then MsgBox [Ô]VOCÊ Jà ESTà NA PRIMEIR LINHA !!![Ô], vbExclamation: Exit Sub
        Grid.Row = iRow - 1
        Grid.TextMatrix(iRow, iCol) = IIf(TxtEdit.Text = [Ô][Ô], 0, TxtEdit.Text)
        Grid_Click
    ElseIf KeyCode = 40 Then
        If Grid.Rows = Grid.Row + 1 Then MsgBox [Ô]VOCÊ Jà ESTà NA ULTIMA LINHA !!![Ô], vbExclamation: Exit Sub
        Grid.TextMatrix(iRow, iCol) = IIf(TxtEdit.Text = [Ô][Ô], 0, TxtEdit.Text)
        Grid.Row = iRow + 1
        Grid_Click
                
    End If
End Sub
Private Sub txtEdit_LostFocus()
    Grid.TextMatrix(iRow, iCol) = IIf(TxtEdit.Text = [Ô][Ô], 0, TxtEdit.Text)
    TxtEdit.Visible = False
End Sub
                
                    Valew Roberto!
                
            
                        Tópico encerrado , respostas não são mais permitidas