Hello every one.,

.. i have this problem about the datagridview..
i try many codes which are being posted by other person to other forum sites. As i can see the codes are really
working, but not for me .. i can add, delete, and retrieve data, but it doesn't show in
datagridview.the codes that are being posted has a button to click with, so that it will display data in datagridview ..i need a code that will automatically display the stored data inside mysql command line client..

can any one help me to find any solution to my problem ..

thanks and godbless=)

I may be misunderstanding your question, but this is pretty much all there is to it to show data in a datagridview.
Just call the method from anywhere and it will display the data in the DataGridView.

Private Sub DisplayDataInDataGridView()
   yourDataGridView.DataSource = Nothing
   Dim con As New MySqlConnection(<your connectionstring>)
   Dim da As MySqlDataAdapter = Nothing
   Dim dt As New DataTable
   Dim SQL As String = ""

   Try
      SQL = "<your select query>"
      con.Open()
      da = New MySqlDataAdapter(SQL, con)
      da.Fill(dt)
      con.Close()
      yourDataGridView.DataSource = dt
   Catch ex As Exception
      If con.State = ConnectionState.Open Then
         con.Close()
      End If
   End Try
End Sub

i would like to query using a text.box then click in button then display what u search in datagridview..how?

This is set up in your SQL at line 9 above.

SQL = "SELECT * FROM someTable WHERE Field1='" & textbox.text & "'"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.