Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

how to Refresh my datagridview in the windows form

$
0
0
my form 1:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cnn As New Odbc.OdbcConnection
        Dim cmd As New Odbc.OdbcCommand()
        Dim dr As Odbc.OdbcDataReader
        Try
            cnn.ConnectionString = "Dsn=class"
            cnn.Open()
            cmd = cnn.CreateCommand
            cmd.CommandText = "insert into customer(custno,custname,address,contactno,email) values(null,'" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')"
            dr = cmd.ExecuteReader
            TextBox1.Text = " "
            TextBox2.Text = " "
            TextBox3.Text = " "
            TextBox4.Text = " "
            MsgBox("Success")
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & " : " & ex.Message)
        End Try
    End Sub



how can i make the datagridview(its in form1) automatically show my new data
Thanks in advance

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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