Member 14621280 Ответов: 1

Datagridview1 не обновляется автоматически


Imports System.Data.OleDb



Public Class DisplayList

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

        Refresh()



    End Sub


    Private Sub DataGridView1_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
        Dim Form As New SongShow

        Form.RichTextBox1.Text = DataGridView1.CurrentRow.Cells(0).Value.ToString()
        Form.RichTextBox1.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString()
        Form.RichTextBox1.Text = DataGridView1.CurrentRow.Cells(2).Value.ToString()
        Form.RichTextBox1.Text = DataGridView1.CurrentRow.Cells(3).Value.ToString()

        Form.ShowDialog()
    End Sub

    Private Sub DisplayList_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown

        If e.KeyCode = Keys.Escape Then
            TextBox4.Clear()

        Else

            e.Handled = True

        End If
    End Sub

    
    Private Sub FillByToolStripButton_Click(sender As Object, e As EventArgs) Handles FillByToolStripButton.Click
        Try
            Me.MAS_SONGSTableAdapter.FillBy(Me.SongDataSet.MAS_SONGS, SM_EDESCToolStripTextBox.Text)
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged

        Me.MAS_SONGSTableAdapter.FillBy(Me.SongDataSet.MAS_SONGS, TextBox4.Text)
        'We need search by query like to view any results contain  part of value

    End Sub

    Private Sub MASSONGSBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles MASSONGSBindingSource.AddingNew
        MAS_SONGSTableAdapter.Update(SongDataSet)
    End Sub

    Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

        DataGridView1.Update()
        DataGridView1.Refresh()
    End Sub

End Class


Что я уже пробовал:

я добавил новую запись через базу данных ms access, но после того, как я обновил свою форму, она не появилась и не обновила новую запись ....

1 Ответов

Рейтинг:
0

OriginalGriff

Вызвать invalidate на нем: Контроль.Метод Аннулирования[^]