I've posted a few days ago how to get my data in a SQL database and show it in a datagridview. I found out how to do this rather quickly however I've been asked if I can add a button to my form and be able to print my datagridview.

My code to show the datagrid:

        Dim id As String
        Dim prognaam As String
        Dim fout As String
        Dim sdrFoutregistratie As SqlClient.SqlDataReader

        Dim tblFoutvermelding As New DataTable
        Dim scmdOpenDatabase As New SqlClient.SqlCommand


        scmdOpenDatabase.Connection = cnnFoutvermeldingSQL
        scmdOpenDatabase.CommandText = "SELECT Id, Prognaam, fout FROM Registratietabel ORDER BY Id"
        sdrFoutregistratie = scmdOpenDatabase.ExecuteReader

        Do While sdrFoutregistratie.Read

            id = sdrFoutregistratie.GetValue(0).ToString
            prognaam = sdrFoutregistratie.GetValue(1).ToString
            fout = sdrFoutregistratie.GetValue(2).ToString

            tblFoutvermelding.Rows(tblFoutvermelding.Rows.Count - 1)("Id") = id
            tblFoutvermelding.Rows(tblFoutvermelding.Rows.Count - 1)("Prognaam") = prognaam
            tblFoutvermelding.Rows(tblFoutvermelding.Rows.Count - 1)("Fout") = fout


        DataGridView1.DataSource = tblFoutvermelding

So my question is how i'm able to add a print function to the form.

Google is your friend here. Example. of many.
EDIT: Just realized that it is not VB code in the example I gave you. But believe me you will find plenty of VB examples too.

I've just found a way to print, however it only prints a small selection of the datagridview, it feels like it just takes a screenshot of the datagrid and prints that, any suggestions how I can print the entire datagrid instead of a small selection of it

Look for a code that prints many pages.

Please read this post carefully. You can get more resources from here about printing in tabuler format.