vb.net - "Please Wait" Form not rendering when called -


i writing program lot of processes @ once. keep user thinking program crashed, decided add "please wait" window. works fine except 1 thing: form doesn't render until 30 seconds later. before "please wait until..." text supposed in form white rectangle.

can please tell me how can fix issue? thanks!

edit:

as assumed had crystal ball , read virtual mind, forgot include code >.>;;

here is:

private sub button3_click(sender object, e eventargs) handles button3.click     dim pleasewait new testespere     centerform(pleasewait)     pleasewait.show()     dim quantity, quantity_purchased integer     dim tracking_usps, lybro_id, recipient_name, order_id, order_item_id, payments_transaction_id, product_id, description, listing_id, sku,            batch_id, buyer_email, buyer_name, address_1, address_2,         city, state, zip, country, special_comments, upc, status_shipment, loc, tracking, etc, eff string     dim total_price, peso, order_price, shipping_price decimal     dim purchase_date, payments_date date      = 0 datagridview1.rows.count - 1         on error goto netx         if isdbnull(datagridview1(0, i).value) exit         datagridview1(33, i).value = trackingrequest(replace(datagridview1(32, i).value, "'", ""))          lybro_id = datagridview1(0, i).value         order_id = datagridview1(1, i).value         order_item_id = if(isdbnull(datagridview1(2, i).value), "", datagridview1(2, i).value)         payments_date = string.format("{0:yyyy-mm-dd}", datagridview1(3, i).value.tostring)         quantity = datagridview1(4, i).value         payments_transaction_id = if(isdbnull(datagridview1(5, i).value), "", datagridview1(5, i).value)         product_id = datagridview1(6, i).value         description = replace(datagridview1(7, i).value, "'", "''")         peso = datagridview1(8, i).value         listing_id = if(isdbnull(datagridview1(9, i).value), "", datagridview1(9, i).value)         sku = datagridview1(10, i).value         order_price = datagridview1(11, i).value         shipping_price = datagridview1(12, i).value         quantity_purchased = datagridview1(13, i).value         total_price = datagridview1(14, i).value         purchase_date = string.format("{0:yyyy-mm-dd}", datagridview1(15, i).value.tostring )         batch_id = if(isdbnull(datagridview1(16, i).value), "", datagridview1(16, i).value)         buyer_email = datagridview1(17, i).value         buyer_name = replace(datagridview1(18, i).value, "'", "''")         recipient_name = replace(datagridview1(19, i).value, "'", "''")         address_1 = replace(datagridview1(20, i).value, "'", "''")         address_2 = if(isdbnull(datagridview1(21, i).value), "", datagridview1(21, i).value)         city = replace(datagridview1(22, i).value, "'", "''")         state = if(isdbnull(datagridview1(23, i).value), "", replace(datagridview1(23, i).value, "'", "''"))         zip = datagridview1(24, i).value         country = replace(datagridview1(25, i).value, "'", "''")         special_comments = if(isdbnull(datagridview1(26, i).value), "", replace(datagridview1(26, i).value, "'", "''"))         upc = if(isdbnull(datagridview1(27, i).value), "", datagridview1(27, i).value)         etc = if(isdbnull(datagridview1(28, i).value), "", datagridview1(28, i).value)         status_shipment = datagridview1(29, i).value         loc = replace(datagridview1(30, i).value, "'", "''")         eff = if(isdbnull(datagridview1(31, i).value), "", datagridview1(31, i).value)         tracking = if(isdbnull(datagridview1(32, i).value), "", datagridview1(32, i).value)         tracking_usps = replace(datagridview1(33, i).value, "'", "''")          cmd.commandtext = string.format("insert re_orders_con_pesos(re_lybro_id, re_order_id, re_order_item_id, re_payments_date, re_quantity, re_payments_transaction_id, re_product_id,                             re_description, re_peso, re_listing_id, re_sku, re_order_price, re_shipping_price, re_quantity_purchased, re_total_price, re_purchase_date, re_batch_id, re_buyer_email,                             re_buyer_name, re_recipient_name, re_ship_address_1, re_ship_address_2, re_ship_city, re_ship_state, re_ship_zip, re_ship_country, re_special_comments, re_upc, re_etc, re_status_shipment,                             re_location, re_eff, re_tracking, re_tracking_usps, re_status_email, re_status_db) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}',                             '{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}', '{33}','{34}','{35}')", lybro_id, order_id, order_item_id, payments_date, quantity, payments_transaction_id,                                         product_id, description, peso, listing_id, sku, order_price, shipping_price, quantity_purchased, total_price, purchase_date, batch_id, buyer_email,                                         buyer_name, recipient_name, address_1, address_2, city, state, zip, country, special_comments, upc, etc, status_shipment, loc, eff, tracking, tracking_usps,                                         estatus_email_nuevo, estatus_db_nuevo)         cmd.execute() netx:     next      pleasewait.close()      beep() end sub 

the code button click event handler run on ui's thread. thread supposed handle display only, moving data around on , using store information database. there wrong attempt solve problems, i, , other commenters, propose band-aid: application.doevents. placement below allow ui respond events , update before process each row in datagridview.

also, on error goto deprecated, replaced newer functional equivalent try .. catch

private sub button3_click(sender object, e eventargs) handles button3.click     dim pleasewait new testespere     centerform(pleasewait)     pleasewait.show()     ' ... (code removed brevity)      = 0 datagridview1.rows.count - 1         ' call allow pleasewait form update         application.doevents()         try             if isdbnull(datagridview1(0, i).value) exit             datagridview1(33, i).value = trackingrequest(replace(datagridview1(32, i).value, "'", ""))             lybro_id = datagridview1(0, i).value             ' ... (code removed brevity)             tracking_usps = replace(datagridview1(33, i).value, "'", "''")             cmd.commandtext = string.format("insert re_orders_con_pesos(re_lybro_id, re_order_id, re_order_item_id, re_payments_date, re_quantity, re_payments_transaction_id, re_product_id,                         re_description, re_peso, re_listing_id, re_sku, re_order_price, re_shipping_price, re_quantity_purchased, re_total_price, re_purchase_date, re_batch_id, re_buyer_email,                         re_buyer_name, re_recipient_name, re_ship_address_1, re_ship_address_2, re_ship_city, re_ship_state, re_ship_zip, re_ship_country, re_special_comments, re_upc, re_etc, re_status_shipment,                         re_location, re_eff, re_tracking, re_tracking_usps, re_status_email, re_status_db) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}',                         '{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}', '{33}','{34}','{35}')", lybro_id, order_id, order_item_id, payments_date, quantity, payments_transaction_id,                                     product_id, description, peso, listing_id, sku, order_price, shipping_price, quantity_purchased, total_price, purchase_date, batch_id, buyer_email,                                     buyer_name, recipient_name, address_1, address_2, city, state, zip, country, special_comments, upc, etc, status_shipment, loc, eff, tracking, tracking_usps,                                     estatus_email_nuevo, estatus_db_nuevo)             cmd.execute()         catch             ' ignoring exceptions, should handling them!         end try     next      pleasewait.close()     beep() end sub 

under normal circumstance, can't think of reason ever use application.doevents. in case, solution without require significant rewrite application.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -