Solved

vb.net datagrid point

Posted on 2017-04-19
4
20 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
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
"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
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
Not a problem Peter, glad to help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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