[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

vb.net datagrid point

Posted on 2017-04-19
4
Medium Priority
?
67 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 64

Accepted Solution

by:
Fernando Soto earned 2000 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 64

Expert Comment

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

650 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