0

i have 2 datagrid and 2 button in one form..

if i click the GO!, the left datagrid will be filled with data..

and if i click the MINING!, surely the right datagrid will be filled..

but the problem is when i click the MINING button, right datagrid will be filled, but the left datagrid's data is automatically unloaded, resulting only right datagrid will be loaded with data..

here's the screenshot

enter image description here

so what i need is the two datagrid will display a data at same time..

is it possible to do that?

and one more question is there a simple way to automatically display a progress bar when i click the MINING button, because when i clicked it, it will run executequery that took a long time to completed, it's about 10 to 60 seconds..

so to show that my program is not HANG, but it's still working on progress to completed..

only a simple circle progress bar will do, i mean there's no need to display an estimated time to complete.. like i said before, it's only to show that my program is working on progress not HANG

and by the way i'm using vb.net and mysql.. thanks before

UPDATED CODE

if ..... then

getcmd= "insert into node(...) select ..."
CMD = New MySqlCommand(getcmd, conn.connect)
CMD.ExecuteNonQuery()
CMD.Connection.Close()

elseif ... then
    getcmd= "insert into node(...) select ..."
    CMD = New MySqlCommand(getcmd, conn.connect)
    CMD.ExecuteNonQuery()
    CMD.Connection.Close()

else
    getcmd= "insert into node(...) select ..."
    CMD = New MySqlCommand(getcmd, conn.connect)
    CMD.ExecuteNonQuery()
    CMD.Connection.Close()

end if
Soni Gunz
  • 135
  • 5
  • 17

1 Answers1

1

If the left grid is getting cleared, check your code, or post some here because that is not normal, you must be clearing the grid at somepoint. Search you code for something like [GridName].Datasource = Nothing or if you are using a bindingsource, something like [BindingSourceControlName].clear. Without more information on how you fill the grid, I cannot give you a better answer.

As for the progress bar, you will need to do some asyncronous call or multi-threading to be able to show progress while making a single call to executequery. This way you can still run code while the call is running. There are third-party grids that have this option built in but not the standard MS grids.

Steve
  • 5,585
  • 2
  • 18
  • 32
  • you're right bro.. i have `datatable.clear` in my syntax which causing the grid's problem.. for the progress bar, could you show it to me the example on how to do it.. i've updated my syntax above.. thx u very much :) – Soni Gunz Jan 31 '14 at 15:59
  • Here is an example: http://stackoverflow.com/questions/16688990/how-to-display-progress-bar-while-executing-big-sqlcommand-vb-net – Steve Feb 03 '14 at 14:55