• Thank you for your reply...

    i did the following:-

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

    myconnection.Open()

    Dim ReturnCount As Int32 = 0

    'define the command

    Dim cmd As New SqlCommand

    cmd.Connection = myconnection

    cmd.CommandText = "SELECT COUNT(*) FROM petrol_costs_table"

    ReturnCount = Convert.ToInt32(cmd.ExecuteScalar())

    cmd.ExecuteNonQuery()

    myconnection.Close()

    MsgBox("Succes....", MsgBoxStyle.Information, "Success")

    TextBox1.Text = ReturnCount

    End Sub

    this work very well