Is there any difference between dropping a BackgroundWorker component on form using designer, or just creating it on code as an object variable. eg ...
BackgroundWorker bgwrkr = new BackgroundWorker();
I would prefer to create in code.
Is there any difference between dropping a BackgroundWorker component on form using designer, or just creating it on code as an object variable. eg ...
BackgroundWorker bgwrkr = new BackgroundWorker();
I would prefer to create in code.
When you drop a component (e.g. the BackgroundWorker or the Timer) on a form, you can set its properties and wire up event handlers in the properties window. The WinForms designer then creates the initialization code for you. Otherwise you must do all this manually.
But there is no difference in the functionality for these two variants. Many components do not need to be dropped on a form and they do not have any relation to the form. You can also instantiate these components in any other class or struct.
But there are also other types of components like ToolTip or ErrorProvider that add functionality to a Form or to a UserControl and make no sense in other classes.