[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb.net datagrid point

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

872 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