I am working on windows form application
i have a form and data grid view..i am filling this data gridview in button click
in button click i am calling my function..my function like this:
Sub filldgv()
DGVReleased.Rows.Clear()
Dim carid As String
Dim VehicleNo As String
Dim DriverID As String
Dim krrt As Integer
Dim Dt As Integer
Dim cmd As New SqlCommand("IBS_fetchresleaseVehicle", con.connect)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@locid", SqlDbType.Int).Value = Glocid
dr = cmd.ExecuteReader
While dr.Read
If dr("TBarcode") Is DBNull.Value Then
carid = ""
Else
carid = dr("TBarcode")
End If
If dr("PlateNo") Is DBNull.Value Then
VehicleNo = ""
Else
VehicleNo = dr("PlateNo")
End If
If dr("DelEcode") Is DBNull.Value Then
DriverID = ""
Else
DriverID = dr("DelEcode")
End If
If dr("KRRT") Is DBNull.Value Then
Else
krrt = dr("KRRT")
End If
If dr("DT") Is DBNull.Value Then
Else
Dt = dr("DT")
End If
Dim row0 As String() = {carid, VehicleNo, DriverID, krrt, Dt}
DGVReleased.Rows.Insert(0, row0)
End While
dr.Close()
con.disconnect()
End Sub
in button click event i am calling my function
Public Sub BtnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRefresh.Click
filldgv()
changecolor()
End Sub
but when ever data is increasing the grid view my application is getting hanging(i mean if the data grid view loading around 100 s of record then application is hanging)
so in btnrefresh click i called background worker..but still my application is getting hanging