[C++/CLI] How to put job in background

Hello, i have application which working with mysql etc, when you press button and on button_press program make query for select or insert, then you must wait for mysql response and at this time program not responding, but how can i make program, when i press button then query go to background and i can interact with form while mysql responding. Because now when i need to write text to label before query and after query say success, then i see only success and sometimes first label "working" or etc. Thanks :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
private: System::Void button_pridanieTasku_Click(System::Object^  sender, System::EventArgs^  e) {
		try
		{
			label_loading->Text = "Prebieha nacitanie projektov...";
			Sleep(200);
			PridanieTasku^ pridanietasku = gcnew PridanieTasku;
			pridanietasku->UserId = UserId;
			pridanietasku->Show();

			label_loading->Text = "Hotovo";
		}
		catch (Exception^ ex)
		{
			label_loading->Text = "Chyba";
		}

	}
Nice, thanks, i try to implement this code into my application :) and last question, it's possible to make progress bar where i can see how much % the mysql query is done? for example select or insert? because i know when you send query then you get answer but i don't know, how can i get some information how much % of query is complete. Thanks :) if it's not possible, then i make only loading icon >D
I don't know a way to get the percentage of the query, but you can set the style of the progress bar to continuous or marquee.

https://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar.style%28v=vs.110%29.aspx
Thanks :)
Topic archived. No new replies allowed.