My datagridview[Resident's Information DatagridView] has a weird behavior. When I try to run my application using Debug in Visual Studio It takes so much time before Datagridview loads fully but when I try to run the program through the external .exe under the Debug folder the datagridview loads fast and no delay. I tried cleaning the project or the solution but to no avail. I also tried building it again.
for reference or much detail see video below:
running the application through visual studio https://drive.google.com/file/d/1LbM--rigXy-m17e7v1DAdmxGnMQ7gE4g/view?usp=share_link
running the application through the .exe file in the Debug folder https://drive.google.com/file/d/1b19jGooDXMjTkaz5aGMYnimyRlikCxhL/view?usp=share_link
Here's how I populate my DataGridView
mySQLCommand.CommandText = "Select * From residents" & (IIf(txtSearchResident.Text.Trim = "" Or txtSearchResident.Text = "Type in your search", " ", " WHERE first_name LIKE @resident_name OR middle_name LIKE @resident_name OR last_name LIKE @resident_name")) & " order by first_name asc limit 30 OFFSET " & (((CInt(Me.txtPageNoResident.Text)) - 1) * 30)
mySQLCommand.Parameters.AddWithValue("@resident_name", "%" & txtSearchResident.Text & "%")
mySQLReader = mySQLCommand.ExecuteReader
While mySQLReader.Read
Dim middle, ext As String
If mySQLReader!middle_name <> DBNull.Value Then
middle = mySQLReader!middle_name + " "
Else
middle = ""
End If
If mySQLReader!ext_name <> DBNull.Value Then
ext = mySQLReader!ext_name
Else
ext = ""
End If
datagrid.Rows.Add(New String() {(mySQLReader!first_name + " " + middle + mySQLReader!last_name + " " + ext), mySQLReader!sex, mySQLReader!is_voter, mySQLReader!contact_no})
End While
Language used: Visual Basic .Net Visual Studio version: 2022 Database: MySQL using Xampp