1. Este site usa cookies. Ao continuar a usar este site está a concordar com o nosso uso de cookies. Saber Mais.

problema em botao inserir em vb.net

Discussão em 'Programação' iniciada por masterx2, 14 de Junho de 2009. (Respostas: 3; Visualizações: 1596)

  1. ola. estou a fazer uma aplicaçao para gerir doentes em vb.net 2008 mas estou com um problema no botao inserir.

    Problema: cada vez que ensiro um novo registo na aplicaçao ela cria automaticamente um registo em branco adicional.

    codigo:

    Public Class Informa‡Æo_sobre_Pacientes
    Private Sub Informa‡Æo_sobre_Pacientes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'Controlo_de_pacienteDataSet.Pacientes' table. You can move, or remove it, as needed.
    Me.PacientesTableAdapter.Fill(Me.Controlo_de_pacienteDataSet.Pacientes)
    'TODO: This line of code loads data into the 'Controlo_de_pacienteDataSet.Pacientes' table. You can move, or remove it, as needed.

    End Sub
    Private Sub PacientesBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Me.Validate()
    Me.PacientesBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.Controlo_de_pacienteDataSet)
    End Sub
    Private Sub PacientesBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Me.Validate()
    Me.PacientesBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.Controlo_de_pacienteDataSet)
    End Sub
    Private Sub PacientesBindingNavigatorSaveItem_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PacientesBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.PacientesBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.Controlo_de_pacienteDataSet)
    End Sub
    Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
    If MsgBox(" deseja apagar o registo", MsgBoxStyle.YesNo, "apagar") = MsgBoxResult.Yes Then
    Me.Validate()
    PacientesBindingSource.RemoveCurrent()
    PacientesTableAdapter.Update(
    Me.Controlo_de_pacienteDataSet.Pacientes)
    Me.PacientesTableAdapter.Fill(Me.Controlo_de_pacienteDataSet.Pacientes)
    End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    If MsgBox(" deseja apagar o registo", MsgBoxStyle.YesNo, "apagar") = MsgBoxResult.Yes Then
    Me.Validate()
    PacientesBindingSource.RemoveCurrent()
    PacientesTableAdapter.Update(
    Me.Controlo_de_pacienteDataSet.Pacientes)
    Me.PacientesTableAdapter.Fill(Me.Controlo_de_pacienteDataSet.Pacientes)
    End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If MsgBox(" deseja guardar registo", MsgBoxStyle.YesNo, "guardar") = MsgBoxResult.Yes Then
    Me.Validate()
    PacientesBindingSource.EndEdit()
    PacientesTableAdapter.Update(
    Me.Controlo_de_pacienteDataSet.Pacientes)
    PacientesTableAdapter.Fill(
    Me.Controlo_de_pacienteDataSet.Pacientes)
    End If
    End Sub
    Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
    If MsgBox(" deseja adicionar registo") Then
    Me.Validate()
    PacientesBindingSource.AddNew()
    End If
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Me.Close()
    Form1.Show()
    End Sub
    Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveNextItem.Click
    PacientesBindingSource.MoveNext()
    End Sub
    Private Sub BindingNavigatorMoveLastItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveLastItem.Click
    PacientesBindingSource.MoveLast()
    End Sub
    Private Sub BindingNavigatorMovePreviousItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMovePreviousItem.Click
    PacientesBindingSource.MovePrevious()
    End Sub
    Private Sub BindingNavigatorMoveFirstItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveFirstItem.Click
    PacientesBindingSource.MoveFirst()
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    End Sub
    End
    Class
     
    Última edição: 15 de Junho de 2009
  2. alfinete

    alfinete Power Member

    poe ai o code
     
  3. ja meti o codigo da aplicação
     
  4. ja resolvi o meu problema. este topico pode ser fechado.
     

Partilhar esta Página