Solved

vb.net datagrid point

Posted on 2017-04-19
4
43 Views
Last Modified: 2017-04-20
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

0
Comment
Question by:PeterBaileyUk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 42099418
Hi Peter;

First you state that Me.DataGridViewStrCommon has only one column in it, is that correct? If it is then this line of code
Me.DataGridViewStrCommon.Rows(ptStrComCurrentCell.Y).Cells(ptStrComCurrentCell.X)

Open in new window

could be written as
Me.DataGridViewStrCommon.Rows(ptStrComCurrentCell.Y).Cells(0)

Open in new window

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?
If CrossGridToolStripMenuItem.Checked = True Then 
    Me.DataGridViewStrCommon.Rows(ptStrComCurrentCell.Y).Cells(0)

Open in new window

It would help to see the complete error message and the inner exception.
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 42100146
"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.
0
 

Author Comment

by:PeterBaileyUk
ID: 42100148
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

0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 42100432
Not a problem Peter, glad to help.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

689 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