|
That's why there are several different types of timers in .NET.
If you can't use a System.Windows.Forms.Timer (because you don't have a GUI) then a System.Timers.Timer should work fine. The events differ a little, but the concept stays the same: Calculate how long until the desired shutdown time and wind up the timer...
Regards,
mav
|
|
|
|
|
I want to create a single setup project that:
1. Upgrades to Windows Installer 2.0
2. installs a C# setup project MSI
Do u think i would be needing to upgrade through the redistributable package of SP2 or is there another way?
I have previously used a similar setup project(available on the microsoft website) that installs a .NET Framework Application and Dotnetfx.exe (the redistributable package of dotnet framework + upgrades to Windows Installer 2.0). This time i dont need the dotnetframework, only need to upgrade the Windows installer to 2.0, so that my MSI runs (it requires Windows Istaller 2.0)
Please help me out here.
Thanks.
|
|
|
|
|
If it's a C# project, the user must have the .NET Framework. All versions of the framework, IIRC, use Windows Installer 2.0. If the user already has the framework, they should already have Windows Installer 2.0.
If you're using VS.NET to create the MSI, in Project Properties you can set the Bootstrapper to 'Windows Installer Bootstrapper'. This copies InstMsiA.exe and InstMsiW.exe (the Windows Installer redistributables) and a Setup.exe to the output folder, and generates a Setup.ini which tells Setup.exe to launch your MSI. If you want to ship that as a single EXE, you should look into something like IExpress[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
Is there a simple method to place two single quotes anywhere there is a single quote so that single quotes can be inserted into a database? Currently I have been searching through each string (textbox, or what ever it may be) and manually (looking at each character in the string) replacing the single quote with two single quotes. I have also tried the Replace function but that does not appear to change the single quotes. If any one has experinced this please pass on your knowledge or point me in the right direction.
Thanks
Joe
|
|
|
|
|
If you use parametarised queries you can get around this problem. Also, parameterised queries are more secure as they are less suseptable to injection attacks.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
And they are much faster too, since the SQL (which has to be compiled) can be cached for every request.
There's simply no excuse for not using them!
|
|
|
|
|
Hugo Hallman wrote:
they are much faster too
Good point! I keep forgetting that. I still have this mind set that you have to make a stored procedure for to have the SQL cached in a pre-compiled state.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
I use replace() for this all the time...
Replace("'", "''")
|
|
|
|
|
hi,
how to send msg to remote host queue using ip address(using System.Messaging.MessageQueue).
|
|
|
|
|
I would like to check if any specific program, e.g. Excel, running.
Can anyone here help me?
Same effect as when upgrading IE, it will check if there is any IE running, if yes, it will warn the user to close all IE before continue.
Thank You!!!
|
|
|
|
|
Process.GetProcessesByName
(System.Diagnostics)
|
|
|
|
|
|
hi,
Why there is a split between IEnumerator and IEnumerable. I mean, why did the designers of .NET decide it was necessary to implement 2 interfaces in order to support enumeration?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
You have to implement every methods of any interface you implement... (stupid sentence, i know)
So, if you just need to be "enumberable", you can simply implement that interface.
Cheers
Sebastian
|
|
|
|
|
hi,
My question is Why Framework Designers kept two interface for achiving one idea. That is cusom Enumeration through a custum collection.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
sreejith ss nair wrote:
why did the designers of .NET decide it was necessary to implement 2 interfaces in order to support enumeration?
Because you might want to have two separate threads enumerate over the same collection at the same time. Because the iteration model used in .NET does not permit alterations to a collection during enumeration this is completely safe.
The IEnumerator interface allows you to get the current state of a particular enumeration. While the IEnumerable interface allows you to retrieve a (normally new) IEnumerator object.
So, if you have two threads they can both get separate objects with an IEnumerator interface to the same collection - and both threads can iterate over the collection at their own speed without coliding with one another.
Also, it allows you to provide sevaral different ways to enumerate over one collection. A collection, through the IEnumerable interface, can expose a default enumeration, while it can also expose more object with the IEnumerator interface for other non-default enumerations. For instance, the default enumerator could just iterate through the collection in the order in which the data appears. While a second IEnumerator could expose the contents of the collection in a particular sort order, or with some filter.
Does this help?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
hi,
Thanks for this information. Yesterday i wrote an article discussing IEnumerable, IEnumerator. And i got a suggection which ask "why microsoft desided like that ?". I can't able to help him out. Now i can and i will do it.
Url. http://www.codeproject.com/csharp/sssienumerable.asp
thanks
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
See also my artice on the same subject: http://www.codeproject.com/csharp/csenumerators.asp[^]
Although I have to admit that I didn't really think about it all that much until you mentioned it here - Maybe it is time to update my article too.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
So then the question changes to why didn't they call them "IThreadSafeEnumerator" and "IAmNotAThreadSafeEnumerator" or something more self-explanatory like that.
Matt Gerrans
|
|
|
|
|
Matt Gerrans wrote:
So then the question changes to why didn't they call them "IThreadSafeEnumerator" and "IAmNotAThreadSafeEnumerator" or something more self-explanatory like that.
Because the thread safety issue is just one example (I should have said that more clearly). Another example is nesting two iterations inside each other that are iterating over the same collection, you wouldn't want the inner loop to corrupt the state of the outer loop.
Does this clear this up a bit better?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Sure, but what I meant was that IEnumerable vs. IEnumerator conveys no difference to the reader; it sounds like two different names for the same thing.
Of course the presence of these two interfaces that are apparently the same thing will cause the conscientious programmer to learn what the differences are, but the lack of distinction in the terminology will always make it more difficult to remember which was which.
So perhaps Enumerator and SafeEnumerator would do the trick (I really don't see the point of cluttering up all interfaces with the 'I' prefix either -- if you don't know it is an interface, you'll find out soon as you try using the new operator on it).
|
|
|
|
|
Anonymous wrote:
IEnumerable vs. IEnumerator conveys no difference to the reader
Anonymous wrote:
but the lack of distinction in the terminology will always make it more difficult to remember which was which.
Yes, it does convey a difference. Words ending in -able convey the meaning that of ability to do something (In this case a collection has the ability to enumerate) and words ending in -or are agent nouns, they convey the meaning of the someone or something that does something.
The collection is enumerable - because you have the ability to iterate over its elements.
The Enumerator is the thing that actually does the iteration.
Anonymous wrote:
I really don't see the point of cluttering up all interfaces with the 'I' prefix either
Historical reasons I suppose - the last vestiges of hungarian notation creeping into .NET
Anonymous wrote:
if you don't know it is an interface, you'll find out soon as you try using the new operator on it
Wouldn't it be quicker not to waste time on that?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Hi all,
I'm looking to implement a web-style UI using Windows Forms and C#. I want my task screens' content to fill the width of the window and to reflow nicely, like a web browser.
While I realise the docking features of Windows Forms are great for resizing content to fit a window, you run into problems when, say, the word-wrapping in a static text control changes such that the line count changes (2 lines become 3, for example). In such a situation, you'd want the controls below the static to shuffle up or down accordingly, but the docking properties aren't enough to cater for this.
Has anyone seen any Forms code that avoids ugly spaces opening up (or conversely, overlapping controls) by correctly reflowing the form's content?
Cheers,
Mal.
|
|
|
|
|
hi,
put little R and D on Anchoring and docking. It may help you out.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Thanks for the reply, but as I explained, the anchoring and docking aren't enough.
Unless, that is, you're telling me to handle the Layout event and do my own layout control? But that's the example I'm hoping I can find without having to code it myself.
Cheers,
Mal.
|
|
|
|