|
S. Senthil Kumar wrote: You could try using System.Threading.Timer[^] instead and it provides a parameter to do one shot firing of the timer.
The same can be achieved by setting the System.Timers.Timer.Autoreset property to false .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
The documentation[^] on the property doesn't say that the timer will fire only once, it says that the Elapsed event will be raised only once, the first time the timer elapses. You could argue it's the same, but the OP has to write code to stop the timer.
|
|
|
|
|
|
In VB there is this out of focus even for a text box. Can some one tell me the equivalent for C#?
I would like to validate a value in the text box when we leave this text box.
Suggestions?
Thanks,Arun
|
|
|
|
|
mrarunks wrote: In VB there is this out of focus even for a text box. Can some one tell me the equivalent for C#?
It is the same framework, so it will have the same events (Unless, by VB you are talking about VB6 or ealier)
|
|
|
|
|
Enable the CausesValidation property and register to the Validating event.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i need to write method and return somevalue from that method
for example return number
and use that number in the rest of application
ma_refay
|
|
|
|
|
From your question I can tell you need more help than can be provided here.
only two letters away from being an asset
|
|
|
|
|
Buy a book. C# Step By Step would be an excellent start.
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture)
http:\\www.frankkerrigan.com
|
|
|
|
|
ma_refay wrote: i need to write method and return somevalue from that method
for example return number
and use that number in the rest of application
You've been asking questions on this site for over a year now and you've only just got around to asking this?
public int SomeMethod()
{
return 1;
}
|
|
|
|
|
Please don't email me direct - I won't respond off line.
ma_refay wrote: how i call the return 1 in my form
or how to assign that return ti variable
int theValue = TheMethodThatReturnsOne();
|
|
|
|
|
I'm trying to send a mail through gmail using System.Net.Mail..but it's giving me errors. here's the code:
<br />
MailMessage msg = new MailMessage();<br />
msg.From = new MailAddress("jiminyjones@gmail.com");<br />
msg.To.Add("sharpie@usmarines.com");<br />
msg.Subject = "C# Mail Message!";<br />
msg.Body = "Hey Buddy!";<br />
msg.IsBodyHtml = false;<br />
SmtpClient b = new SmtpClient();<br />
b.Host = "smtp.google.com";<br />
b.Send(msg);<br />
I know the problem is with the authentication because gmail requires ssl, but i couldn't find a way to fix it (i tried "b.EnableSsl = true" but it didn't work).
|
|
|
|
|
I don't think gmail has an open SMTP relay.
You are not supplying a username or password for the smtp server to authenicate you.
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture)
http:\\www.frankkerrigan.com
|
|
|
|
|
well, so how do i supply a username and password? :\ that's what i'm asking
|
|
|
|
|
|
Hello everyone -
a short (noob) question:
how do i copy an object containing a Dictionary making sure that the contents of the Dictionary are copied too ?
ex.
class A
{
public Dictonary<string,string> test = new Dictionary<test,test>;
}
...
A a = new A();
A b = new A();
A.test.Add("string1","string2");
b = a; // !! should perform a deep copy of the dictionary, but only copies a reference
b["string1"]= "anotherstring"; // !does also change a's ["string1"] entry but should not!
I do not get it to work...
Anyone can help me out of my misery ?
Thanks,
Amorphis
-- modified at 10:05 Friday 2nd March, 2007
|
|
|
|
|
You need to implement the Icloneable in your dictionary and use clone, that is what it is for, deep copies.
Hope that helps.
Ben
|
|
|
|
|
You can like the other poster create your own class and add the ICloneable interface to it.
But if you're wanting a way to perform a copy of a dictionary with out deriving a new class, you can do this as well...
For dictionaries that contain ICloneable objects:
Dictionary<KeyType, ValueType> dctSource, dctClone;<br />
<br />
dctSource = new Dictionary<KeyType, ValueType>();<br />
dctClone = new Dictionary<KeyType, ValueType>();<br />
<br />
foreach (KeyType key in dctSource.Keys)<br />
dctClone[key] = dctSource[key].Clone();
For dictionaries that contain strings like in your example:
dctSource = new Dictionary<string, string>();<br />
dctClone = new Dictionary<string, string>();<br />
<br />
foreach (string key in dctSource.Keys)<br />
dctClone[key] = dctSource[key];
(You don't have to clone the strings as they are immutable.)
|
|
|
|
|
Thanks, that was the info I needed - now it works as expected
Regards,
Amorphis
|
|
|
|
|
How can i convert DRM protected Audio files(M4p,WMA format) into Unprotected audio file(WMA,MP3 format).
Bala
|
|
|
|
|
Put it simply, you can't.
|
|
|
|
|
If you have the licence of file it´s easy.
|
|
|
|
|
Yes i have a audio files which are downloaded by payment from Apple website.
So please tell me how to proceed further.
Bala
|
|
|
|
|
I just added three items in combo box and I made the SelectedIndex = 0. I would like to lock the combo box so that the user not be able to select other than the first item.
|
|
|
|
|
Just set comboBox.Enabled = false;
|
|
|
|