I always failed to load DataGridView customers. They always freeze on record #8
I have a Customers class under my apps namespace like this
public class Customers
{
public string No { get; set; }
public string ID { get; set; }
public string NoSPU { get; set; }
public string Name { get; set; }
public string Telp { get; set; }
public string Kavling { get; set; }
public string Tipe { get; set; }
public string Pokok { get; set; }
public string Bunga { get; set; }
}
And this is my code to add item to customersBindingSource in my DataGridView and I put in formLoad event
string query = "select * from customer";
customersBindingSource.Clear();
Int32 i = 0;
MySqlDataReader reader = dx.findQuery(query);
while (reader.Read())
{
i++;
customersBindingSource.Add(new Customers() {
No = i.ToString(),
ID = reader.GetString("id"),
NoSPU = reader.GetString("nospu"),
Name = reader.GetString("nama"),
Telp = reader.GetString("telp"),
Kavling = reader.GetString("kavling"),
Tipe = reader.GetString("tipe")
});
MessageBox.Show(i.ToString()+" OKE");
}
reader.Close();
If I'm trying with data less than 8 on customers table it always work, but when I add new customers more than 8 it's always freeze, customers forms doesn't show up. Are there's a limitation or something wrong with my code?