Why datagrid view doesnt work in vb.net?
Why datagrid view doesnt work vb.net? I have tried following code but it doesnt work. Would you please tell me why doesnt it work? Please check my code....

Imports System.Data.SqlClient

Public Class Form34
    Private Const ConnectionString As String = "Server=.\SQLEXPRESS;" & _
    "Database=SUIMT;Trusted_Connection=True"

    Public Function GetData() As DataTable
        Dim SelectQry = "Select row_num, stu_id, tot_amou, paid, du, aoins, due, dt From monthly_instal where stu_id = '" & cmbdmiidn.Text & "' AND dt = '" & cmbdmidt.Text & "'"

        Dim connection As New SqlConnection(ConnectionString)
        Dim returnData As New DataTable("monthly_instal")
        Try
            connection.Open()
            Dim command As New SqlCommand(SelectQry, connection)
            Dim adapter = New SqlDataAdapter(command)
            adapter.Fill(returnData)
            con.Close()
        Catch ex As Exception
            returnData = Nothing
            If connection.State = ConnectionState.Open Then
                connection.Close()
            End If
        End Try
        Return returnData
    End Function

   Private Sub cmbdmidt_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbdmidt.Leave

dg1.DataSource = Nothing
        
dg1.DataSource = GetData()
    
End Sub

End Class
Why datagrid view doesnt work in vb.net?
===

Why datagrid view doesnt work vb.net? I have tried following code but it doesnt work. Would you please tell me why doesnt it work? Please check my code....

Imports System.Data.SqlClient

Public Class Form34
    Private Const ConnectionString As String = "Server=.\SQLEXPRESS;" & _
    "Database=SUIMT;Trusted_Connection=True"

    Public Function GetData() As DataTable
        Dim SelectQry = "Select row_num, stu_id, tot_amou, paid, du, aoins, due, dt From monthly_instal where stu_id = '" & cmbdmiidn.Text & "' AND dt = '" & cmbdmidt.Text & "'"

        Dim connection As New SqlConnection(ConnectionString)
        Dim returnData As New DataTable("monthly_instal")
        Try
            connection.Open()
            Dim command As New SqlCommand(SelectQry, connection)
            Dim adapter = New SqlDataAdapter(command)
            adapter.Fill(returnData)
            con.Close()
        Catch ex As Exception
            returnData = Nothing
            If connection.State = ConnectionState.Open Then
                connection.Close()
            End If
        End Try
        Return returnData
    End Function

   Private Sub cmbdmidt_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbdmidt.Leave

dg1.DataSource = Nothing
        
dg1.DataSource = GetData()
    
End Sub

End Class