Link to home
Start Free TrialLog in
Avatar of PeterBaileyUk
PeterBaileyUk

asked on

vb.net datagrid point

I have a small sub but I cannot see how to set the last part on the second dataview, the first has two columns the last datagrid only one so its complaining of too many arguments but not sure of the syntax.

The saving of the point works as expected

    Public Sub Reverttosaved()
        If SaveLastItemSavedAndApplyToRefreshToolStripMenuItem.Checked = True Then *** works

            TxtBulkShortDesc.Focus() *** works
            TxtBulkShortDesc.Text = LblLastSavedSearch.Text *** works
            SendKeys.Send("{Enter}") *** works
        ElseIf GoToLastSavedCellInGridToolStripMenuItem.Checked = True Then  *** works
            Me.DataGridViewStringsBulk.CurrentCell = Me.DataGridViewStringsBulk.Rows(ptCurrentCell.Y).Cells(ptCurrentCell.X)  *** works
            If CrossGridToolStripMenuItem.Checked = True Then Me.DataGridViewStrCommon.Rows(ptStrComCurrentCell.Y).Cells(ptStrComCurrentCell.X)  *** too many args
        End If
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PeterBaileyUk
PeterBaileyUk

ASKER

"This line of code references a cell in the DataGridView but it does nothing with it. do you want to write to it or use its value?"  this is what I had omitted to do as soon as I added that all worked fine thank you so much.
here is the final working sub for completeness.
    Public Sub Reverttosaved()
        If SaveLastItemSavedAndApplyToRefreshToolStripMenuItem.Checked = True Then

            TxtBulkShortDesc.Focus()
            TxtBulkShortDesc.Text = LblLastSavedSearch.Text
            SendKeys.Send("{Enter}")
        ElseIf GoToLastSavedCellInGridToolStripMenuItem.Checked = True Then
            Me.DataGridViewStringsBulk.CurrentCell = Me.DataGridViewStringsBulk.Rows(ptCurrentCell.Y).Cells(ptCurrentCell.X)
            If CrossGridToolStripMenuItem.Checked = True Then Me.DataGridViewStrCommon.CurrentCell = Me.DataGridViewStrCommon.Rows(ptStrComCurrentCell.Y).Cells(ptStrComCurrentCell.X)
        End If
    End Sub

Open in new window

Not a problem Peter, glad to help.