Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questioncherche désespérément comment faire une mise a jour après un formulaire de détails. Composé de textbox
Et j'aimerais aussi ajouter ou supprimer des données dans un datagridviewdonc selon vous c est nous qui aller préciser ta technologie (ODBC.....) hum tu es vrement Gentil
Private Sub UpdateRowToDatabaseODBC() If Not IsNothing(LastDataRowODBC) Then If (LastDataRowODBC.RowState = DataRowState.Modified) Then AdapterODBC.DeleteCommand = commandBuilderODBC.GetDeleteCommand(True) AdapterODBC.InsertCommand = commandBuilderODBC.GetInsertCommand(True) AdapterODBC.UpdateCommand = commandBuilderODBC.GetUpdateCommand(True) Try AdapterODBC.Update(LastDataRowODBC.Table) Catch ex As Exception End Try ElseIf (LastDataRowODBC.RowState = DataRowState.Added) Then For Each row As Object In LastDataRowODBC.ItemArray Console.WriteLine(row) If IsDBNull(row) Then row = DBNull.Value Next End If End If End Sub '************************ Dim thisBindingSource As BindingSource = CType(PersonnelBindingSourceODBC, BindingSource) dataRowCopODBC = CType(thisBindingSource.Current, DataRowView).Row
Public Class Details Private Sub btn_maj_Click(sender As Object, e As EventArgs) Handles btn_maj.Click End Sub Private Sub btn_annuler_Click(sender As Object, e As EventArgs) Handles btn_annuler.Click Me.Close() End Sub End ClassJe ne sais pas si c'est utile mais je le met quand même.
Imports System.Data.SqlClient Imports System.Windows.Forms Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: cette ligne de code charge les données dans la table 'DataSet11.information'. Vous pouvez la déplacer ou la supprimer selon vos besoins. Me.InformationTableAdapter.Fill(Me.DataSet11.information) 'TODO: cette ligne de code charge les données dans la table 'DataSet1.information'. Vous pouvez la déplacer ou la supprimer selon vos besoins. Me.InformationTableAdapter.Fill(Me.DataSet1.information) 'TODO: cette ligne de code charge les données dans la table 'DataSet1.materiel'. Vous pouvez la déplacer ou la supprimer selon vos besoins. Me.MaterielTableAdapter.Fill(Me.DataSet1.materiel) End Sub Private Sub lst_materiel_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lst_materiel.SelectedIndexChanged Dim idmateriel As New DataView idmateriel.Table = DataSet1.information idmateriel.RowFilter = "id_materiel=" & lst_materiel.SelectedItem(0) DataGridView1.DataSource = idmateriel End Sub Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick Dim i As Integer = e.RowIndex 'Numero de la ligne Dim col1 As String Dim col2 As String Dim col3 As String Dim col4 As String Dim col5 As String Dim col6 As String col1 = Me.DataGridView1.Rows(i).Cells(0).Value.ToString col2 = Me.DataGridView1.Rows(i).Cells(1).Value.ToString col3 = Me.DataGridView1.Rows(i).Cells(2).Value.ToString col4 = Me.DataGridView1.Rows(i).Cells(3).Value.ToString col5 = Me.DataGridView1.Rows(i).Cells(4).Value.ToString col6 = Me.DataGridView1.Rows(i).Cells(5).Value.ToString Details.txt_lieu.Text = col1 Details.txt_adresseip.Text = col2 Details.txt_idinfo.Text = col6 Details.txt_type.Text = col3 Details.txt_nserie.Text = col4 Details.ShowDialog() End Sub Private Sub btn_valider_Click(sender As Object, e As EventArgs) Handles btn_valider.Click Me.InformationBindingSource.EndEdit() Me.InformationTableAdapter.Update(Me.DataSet1.information) End Sub Private Sub Form1_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Dim messagequitter As Integer messagequitter = MsgBox("Etes-vous sure de vouloir quitter ?", vbYesNo + vbQuestion, "Quitter") If messagequitter = vbYes Then End End Sub End Class