|
When writing code in Visual Studio .NET the notational code dropdowns have tooltips next to them.
How do you write classes which produces this behaviour?
I think it's somthing to do with metadata, but not sure what or where...
Thanks
|
|
|
|
|
|
Thanks Marc
I am slowly comming to the conclusion that I will have to write in C#, and not VB.NET as this feature does not seem to be available in VB.NET.
I know this a C# forum, but I didn't think I would get an answer from the VB camp.
Looking at the solution I think I may have been wright.
|
|
|
|
|
You are correct. Under "Coding Techniques" for Visual Studio, I found the following:
If developing in C#, use the XML Documentation feature.
I suspect that only C# supports this feature because Microsoft pushed C# to be a standard, which it now is (supported by an outside standard committee not related to Microsoft--I can't remember the name). Another reason to code in C# and not VB (oops, biased statement!)
Marc
|
|
|
|
|
Hey all -
how exactly do you get the current date in C#? Last week when I writing a bunch of stuff in VB.NET, I was able to simply write:
new DateTime().Now().ToString()
Alas, it appears not so in C#... when I try to use Now as a static member I'm barked at and when I look at the default date the constructor initializes it is:
1/1/0001
Thanks much
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
Fine for me, String dt = DateTime.Now.ToString();
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
The wildest little inconsistency:
The DateTime class exposes Now as a static member in C# but allows you to get it as an instance member in VB.NET. In other words, you can say:
<br />
dim x as String = new DateTime().Now.ToString() <br />
in VB.NET
but in C# you cannot say:
<br />
string x = new DateTime().Now.ToString();<br />
Anyone know why?
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
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
|
|
|
|