C# How do I pause code until another piece of code is complete?
So lets assume i have two classes, one is the winform, and another is a
class.cs within the resources. So when the form is loaded i run code (
resources.scripts.db_connect.getinfo(); ) which goes to the db_connect
class and runs method getinfo. Then the winform will continue to run
through code before the database has a chance to be read. This means the
txtboxes aren't being updated.
I can think of two solutions,
A) Amend the text box within the database connection method. (this poses a
problem for appending controls across classes) orr..
B) pause the code on the winform until the database connection is closed
and a there is a trigger firing the winform to continue on coding.
If there are any other solutions, please let me know! if not, how do i go
about either, all my efforts so far have been in vain :(
(Just to clarify, what i "want" is for the application to start > windows
form to load > connect to database and read > write those to text boxes /
labels)
No comments:
Post a Comment