|
afronaut wrote:
but in C# you cannot say:
string x = new DateTime().Now.ToString();
Now is a static property of the DateTime class. When getting the property, a DateTime instance is created for you, so no need to do it again. Tip: think of as just another construtor (like many other static methods that also returns an instance of a class) with a meaningful name. Now, that sound a lot better than just DateTime() , but it adds meaning to the object.
Hope this helps
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
I just find it intriguing that VB.NET allows access to static members via *instance* variables. Actually, it's not really intriguing, it's just *wrong*.
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
|
Here is how to get at string with the current DateTime in c#.
DateTime d1;
d1 = DateTime.Now;
MessageBox.Show(d1.ToString("G"));
The DateTime.ToString() method accepts many formatting strings, see the doc for details. The "G" format is mm/dd/yyyy hh:mm:ss.
|
|
|
|
|
Anonymous wrote:
MessageBox.Show(d1.ToString("G"));
The DateTime.ToString() method accepts many formatting strings, see the doc for details. The "G" format is mm/dd/yyyy hh:mm:ss.
Hi, the default behavior for the ToString() method for most classes (maybe all???) is "G", so no need to even use that
Cheers 3 less keys too type
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
How do you send an email message using C# WITHOUT using System.Web.Mail namespace?
I have a windows service that does some monitoring and I want it to send out an email after some trigger.
Thanks in advance,
David
P.S. AGAIN...WITHOUT USING THE SYSTEM.WEB.MAIL NAMESPACE!!!!!!
|
|
|
|
|
|
|
OpenSmtp on SourceForge does a nice job and it works on all Win platforms and it does NOT use THE SYSTEM.WEB.MAIL NAMESPACE!!!!!!
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
Have you tried System.Web.Mail?
PS - If that doesn't work, try System.Web.Mail.
|
|
|
|
|
You need to use sockets library to initiate a tcp/ip connection over port 25 and supply the necessary SMTP commands to send an email. This requires an SMTP server though.
It shouldn't be hard to code a simple email sending application but if you would like to use features like mime emails, attachments etc, you'll need an emailing component like devMail.Net- http://www.devmail.net[^]
Hakan
|
|
|
|
|
I didnt mean for my post to stir up so many flames, I just wanted to make sure that I didnt get responses saying to use the system.web.mail namespace as I did in previous postings.
Thanks for the commerical suggestions.
I did find the following:
http://www.c-sharpcorner.com/internet/simpleSMTPMailer.asp
|
|
|
|
|
I am desperate for help! This is really eating my breakfast, lunch and dinner!
I have a class I have derived from the native ListView class. I have a context menu that I show when the user right clicks on a selected item in the list. When they select the "Delete" option in the context menu, I do a ListView.RemoveAt(index) where index is the index of the item they selected. The remove at works, but when the method returns control to the operating system, I get an unhandled exception with the following exception text.
************** Exception Text **************
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: '0' is not a valid value for 'displayIndex'.
at System.Windows.Forms.ListViewItemCollection.get_Item(Int32 displayIndex)
at System.Windows.Forms.ListView.LvnBeginDrag(MouseButtons buttons, NMLISTVIEW nmlv)
at System.Windows.Forms.ListView.WmReflectNotify(Message& m)
at System.Windows.Forms.ListView.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I can find no place in the remainder of my code where I am trying to attempt to access an item from the listview. Can anyone help decipher what my problem is?
dpb
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
|
It has to do with the fact that there is no item in the place of the one that I removed (i.e. - I only get the error when it is the only item in the list or the last item in the list).
However, I have tried to select a different item (via ListView1.Items[removedIndex-1].Selected=true) when I have multiple items in the list, but I still get the error.
Any further help would be greatly appreciated!
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
|
I miss how I could look at just the header file to see all the class methods. Yes, sometimes there was a lot of inline "clutter", but for the most part, I could get a "at a glance" concept of the class.
Yes, there's the outlining capability, but I find it annoying to use. Lots of mouse clicks, it would be nice if I could set it to always collapse when I load file, etc. Yes, there's the XML documentation capability, but that's if I or someone who wrote the class actually documented the functions in that way (of course, we all should!)
What was the rational behind separating definition from implementation?
Marc
|
|
|
|
|
Oops. I meant, "what was the rational behind merging definition with implementation?
Marc
|
|
|
|
|
You have the ClassView to see all those thingies. (the Group by type is the nicest sorting).
You may write interfaces in separate .cs files, which is actually what C++ headers stand for.
That said, I have to agree I have yet to see a single sample using interfaces (not for marshalling).
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
Thanks for the info! I never used the ClassView in VC6, so I totally forgot about that feature. On further investigation, I also noted that the object browser displays the XML comment tags for the different types.
Marc
|
|
|
|
|
I find the Object Browser extremely helpful
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
leppie wrote:
I find the Object Browser extremely helpful
The Object Browser come from VB. There are many people that will stop using it now, because of this information. As you can see there *are* some coll things from VB
Ñ There is only one MP Ð
|
|
|
|
|
Maciej Pirog wrote:
There are many people that will stop using it now, because of this information.
Why do you say that? And what infomation are you talking about?
Sorry, but I am a bit confused
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
leppie wrote:
And what infomation are you talking about?
That the Object Browser come from VB. That was a joke about people who are talking that VB is a sh*t but know nothing about it.
Ñ There is only one MP Ð
|
|
|
|
|
You can set it to collapse when you open the file...can't remember where it was cause I'm on my Mom's computer right now...but I'll look for it later this afternoon.
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|