Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Move to next row

$
0
0

Hi guys.. i have this issue with my application. when i update my sql database from 4 text boxes i want the datagridview to select the next row whenever i hit the save button .. the thing is  that it works fine when i dont refill the tableadapter the display changes on the datagrid using just 

Private Sub savenotes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles savenotes.Click

        Dim a, b, c, d As String
        a = surveil.Text
        b = dev01.Text
        c = dev02.Text
        d = exam.Text
        Dim count As Integer = Noteseleves1DataGridView.Rows.Count

        If ComboBox3.SelectedIndex = 1 Then
            a = "Exmpt"
            b = "Exmpt"
            c = "Exmpt"
            d = "Exmpt"

            dbcommands("update etudier set surveil='" & a & "', not_dev1= '" & b & "', not_dev2='" & c & "', not_exam='" & d & "' where trimestre ='"& trimestre.SelectedValue & "'and matr_el='" & matrelnotes.Text & "'and libelle_mat='" & matiere_notes.SelectedValue & "'")
            ComboBox3.SelectedIndex = 0
            Me.Noteseleves1TableAdapter.Fill(Me.SchoolDataset.noteseleves1)
        Else
            If a = "" Or b = "" Or c = "" Or d = "" Then
                MsgBox("Vous devez remplir tous les chanmps pour enregistrer.", MsgBoxStyle.Exclamation)
            Else

                dbcommands("update etudier set surveil='" & a & "', not_dev1= '" & b & "', not_dev2='" & c & "', not_exam='" & d & "' where trimestre ='" & trimestre.SelectedValue & "'and matr_el='" & matrelnotes.Text & "'and libelle_mat='" & matiere_notes.SelectedValue & "'")
                surveil.Text = ""
                dev01.Text = ""
                dev02.Text = ""
                exam.Text = ""
                abs01.SelectedIndex = 0
                abs02.SelectedIndex = 0
                abs03.SelectedIndex = 0
                abs04.SelectedIndex = 0
                surveil.Enabled = True
                dev01.Enabled = True
                dev02.Enabled = True
                exam.Enabled = True
                surveil.Focus()

                Noteseleves1TableAdapter.Fill(Me.SchoolDataset.noteseleves1)
                Me.BindingNavigatorMoveNextItem4.PerformClick()


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>