|
You have not mentioned, How you want to use that service?
SVC file is only required to register a service as a windows service, so a simple .EXE file can be register as windows services.
You can directly use that Exe file and execute it using Shell command.
Regards
Rushi
|
|
|
|
|
hi,
I have used the below code on datagridview1_ColumnHeaderMouseClick
foreach (DataGridViewColumn x in datagridview1.Columns)
{
x.SortMode = DataGridViewColumnSortMode.Automatic;
x.Selected = true;
}
sorting is not happening ...
even i have tried...
private int Order=-1;
the below code is inside datagridview1_ColumnHeaderMouseClick
Collapse | Copy Code
ListSortDirection sortDirection;
if (this.datagridview1.SortedColumn.Name == "Number")
{
if (this.Order == -1)
{
sortDirection = ListSortDirection.Descending;
datagridview1.Sort(datagridview1.Columns["Number"], sortDirection);
datagridview1.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.Descending;
this.Order = 1;
}
else
{
sortDirection = ListSortDirection.Ascending;
datagridview1.Sort(datagridview1.Columns["Number"], sortDirection);
datagridview1.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.Ascending;
this.Order = -1;
}
}
even the above code is not working....
please help me regarding the same....
|
|
|
|
|
Hi,
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.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, May 10, 2011 11:31 PM
|
|
|
|
|
Hi, how can i get the real html code in a webbrowser object??? a mean, if the page has the following code:
Document.write("Text");
i wanna get the code after the js runs. what i want is to get this:
Text
thanks,
Marcus.
|
|
|
|
|
I'm not sure, however I would try this:
- make sure your Internet Explorer has JavaScript enabled;
- 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.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks, but webbrowser1.DocumentText doesnt work, it gets:
<html>
<body>
Document.write("Text");
</body>
</html>
=/ i dont know what to do anymore.
|
|
|
|
|
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".
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I think it exists, firebug shows the final HTML, but ok... i will look for DOM. Thanks anyway!!
Marcus.
|
|
|
|
|
The thing to remember is that the final HTML may well be rendered out and extended using something like jQuery to append additional content.
|
|
|
|
|
There's no such thing as the "final HTML". Documents can be modified by any number of scripts and by any number of actions on the web page and at any time AFTER the document complete events fire. Click a button and a DIV might disappear. There's no way to tell.
Your concept of a "final HTML" just doesn't exist, even more so today with more script, Flash, AJAX, HTML5, ... HTML is far from a static entity.
|
|
|
|
|
|
Hi guys,
First of all - I am not very experienced. I have the following strage situation:
Task t = null;
t = Task.Factory.StartNew(() =>
{
while (true)
{
// do some calculations
LogToUi("some result");
Thread.Sleep(15000);
}
});
LogToUi is a function that updates a textbox in the UI. It does it pretty straightforward tbUpdateMe.Text = passedtoLogToUiText;
This works just fine, it also works if I use a listbox instead of textbox, but If I would like to change LogToUi to update a datagridview - it does not work.
I was told that in general what I have written should not work.... But it does... So why?
A friend of mine told me that even with textbox it should not work... But it does... So what is the situation and can I expect that it will work with TextBox but not very stable or what?
|
|
|
|
|
So long as your LogToUi method is invoking to the UI thread then any control can be updated successfully. If not, you will end up with illegal cross thread exceptions, or your app may crash (eventually!) if you have these turned off.
|
|
|
|
|
Invoke is required, here[^] is more about it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, May 10, 2011 5:56 PM
|
|
|
|
|
|
Thanks. I accidentally provided the link to my local copy... Fixed it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
Thanks Alan.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Yeah, I'm surprised it ever works like that. Maybe you get lucky every once in a while and the task is scheduled on the UI thread...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
For some controls it will work correctly ... most of the time. This is why .Net now catches them and throws and exception, because it is inconsistent and very difficult to catch otherwise.
|
|
|
|
|
I have experienced that it may work without invoke on one machine but it doesn't work on other machines (and took a long time trying to find that out with the assumption that part was not the problem). So it's better to use invoke regardless.
|
|
|
|
|
|
I am fixing to begin writing an app the obvious design is simple however it will most likely not scale very well.
What I am trying to do is have an app that notifies a user when an action needs to be taken.
My initial thought was to have a table that it read based on user and showed new actions.
I will have about 1000+- user hitting this app I want it to be fairly close to real time.
So my question is how are other doing this?
I have read about WCF however it seems convoluted and possibly overkill.
Another thought I had was to have a service running on a server that could send messages out to the other apps it would only need be a one way communication.
Are there other ways to accomplish this?
I have read WCF has quite alot of overhead as well is this correct?
Thank you,
EDIT*** This a winforms app FYI.
Humble Programmer
-- Modified Tuesday, May 10, 2011 1:49 PM
|
|
|
|
|
Unless all 1000+- users are on the same machine, then your app IS a "server".
I'm assuming the users are remote, however, so you need to consider how they will connect to your server app to receive push notifications.
What protocol will you use? For example, TCP/IP using sockets works but do you want every user solidly connected? What happens on disconnects? Who manages the firewall issues? etc...
I personally would use HTTP over TCP/IP. No firewall issues for most clients.
I would also probably use WCF since it comes with HTTP bindings that allow push notifications from a server. Sure you could roll your own HTTP server using IHttpHandler but since HTTP is request/reply and connectionless, you'd have to reinvent code that's already available out of the box with WCF.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Go ahead with WCF as it support TwoWay Bindings so your server can notify your clients.
Overhead to WCF are only to its complex implementation, but at same time it is useful in particular problems.
Search in Google for TwoWay binding in WCF you will get enough resources.
Regards
Rushi
|
|
|
|