Jump to content
Sign in to follow this  
Chamuanza

A referência de objecto não foi definida como uma instância de um objecto.

Recommended Posts

Chamuanza

Um Bem Aja a Todos

Tenho esta rotina que no primeiro acesso (Load) ao Form funciona bem mas que apresenta o erro em titulo (A referência de objecto não foi definida como uma instância de um objecto).

 na Linha = Me.DatagridView1.CurrentRow.Index(),   quando depois de sair do Form o acesso novamente.

Não entendo o porquê, uma vêz que inicialmente funciona. 

Agradeço umas dicas. Obrigado

 

Imports System.Windows.Forms.DataGridView

Public Class frmRoscaMetricaFina

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Form1.Show()

        Me.Close()

    End Sub

    Private Sub frmRoscaMetricaFina_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'RoscasDataSet.SIFina' table. You can move, or remove it, as needed.
        Me.SIFinaTableAdapter.Fill(Me.RoscasDataSet.SIFina)

    End Sub

    Private Sub DataGridView1_CurrentCellChanged(sender As Object, e As EventArgs) Handles DataGridView1.CurrentCellChanged

        Dim Datagridview1 As New DataGridViewRow
      
        Dim Broca As Decimal

        Dim Linha As Integer

        Linha = Me.DataGridView1.CurrentRow.Index()

        Broca = Me.DataGridView1(0, Linha).Value - Me.DataGridView1(1, Linha).Value

        Label2.Text = "Ø da Broca para Roscar - " & Broca & " mm"

      
           End Sub
End Class

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.