c# - prevent freeze gif file at the same time searching text in database -
this question has answer here:
i want search data in database , show result. when searching word in db, want show group box(gbloading) label , gif image control, gif file freeze when searching word. how can change code prevent freezing gif image in group box of form.
my code :
private void btsearch_click(object sender, eventargs e) { gbloading.location = new point(this.width / 2 - 100, this.height / 2 - 30); gbloading.visible = true; application.doevents(); list<bookauthorsfieldset> resources = db.search(resourceorautor, txsearch.text.trim()); datatable dt = convertlisttodatatable(resources); dgvresourcesorauthors.datasource = dt; dgvresourcesorauthorscount.text = "result count : " + dgvresourcesorauthors.rows.count.tostring(); application.doevents(); dgvspecialresourcesorauthors.datasource = null; gbloading.visible = false; }
do asynctask db search/load. i'd suggest activity implements interface create, perhaps iloadcompleted 1 method loadcompleted or that. send reference activity , on postexecute use reference iloadcompleted execute loadcompleted activity knows asynctask done.
Comments
Post a Comment