What do you mean by "using" it? If you want to start or stop the service, you can use ServiceController class.
If you need to call a method from the service, you should not be using the service at all. If it has class library collection for the business layer and data access etc, use them as reference in your application.
"The worst code you'll come across is code you wrote last year.", wizardzz[^]
a DGV is a complex Control. I got it sorting any way I want, see e.g. my "CP Vanity" article.
From memory, and maybe not 100% accurate:
1. It would not sort (but throw some exception) when databound to something that does not implement IBindingList; that is why I often use a DataTable, not just a List as a data source.
2. It would sort in the natural way when set to Automatic, without requiring any extra code.
3. It could be made to sort in odd ways by setting to Programmatic and calling Sort() explicitly, again see CP Vanity.
Note: I would never change the sort mode inside a click handler, in fact I think the sort mode for each column typically should be constant throughout the app's life, it may be different amongst columns, but I see no need to change it over time.
I'm not sure, however I would try this:
- use a WebBrowser;
- have it Navigate(string) to the URL you want;
- use it's DocumentCompleted event to obtain its Document property.
Caveat: complex pages may fire their DocumentCompleted event many times; what I typically do is compare the current WebBrowserDocumentCompletedEventArgs.URL with the original one, until they match.
I'm not sure the "final HTML" actually exists at all; it could well be the browser interprets the incoming data and processes it on the fly, yielding data structures with displayable items that will eventually be shown.
This[^] and other Google hits suggests there is a way, not necessarily an easy one. Start studying "DOM".