|
Hello,
I have the follwing code:
public static void SendNewsletter ( string Address, StringCollection
scPictures, string Text )
{
MailMessage mm = new MailMessage();
mm.To = Address;
mm.Body = Text;
mm.From = "XXX@XXX.coml";
mm.Subject = "Your weekly newsletter";
mm.BodyFormat = MailFormat.Html;
foreach ( string s in scPictures )
mm.Attachments.Add ( new MailAttachment (s));
SmtpMail.Send ( mm );
}
In outlook and outlook express the images appear just in the HTML and the recipent gets to see perfect HTML page, but the images also appear as seperate attachements!!! When I get newsletters in HTML hte attachmetns are never visible! What am I doing wrong?
Any help appreciated
Henk
|
|
|
|
|
Well from your code, you are attaching the images as attachments. Outlook Express will preview a picture attachment for you, that is why you are seeing it in the message.
Typically what html newsleters do is have a full html page that is sent and the images are not in the mail message, but usually they refer to a web server. This keeps the email messages small.
Steve Maier, MCSD
|
|
|
|
|
ResourceManager rm=new ResourceManager("Images",this.GetType().Assambly);
I don't know what's the meaning of the two parameters("Images",this.GetType().Assambly).
thanks.
Nothing!?@#
|
|
|
|
|
I have made a Jave Applet that can draw vector graph. I use it in HTML page
at Internet. I know that another way is I can developed a OCX control to do
this task. But the later's size is larger than Java Applet. Here has .NET,
extra choice. I want know if I write the control by C#(It is a .NET control),
what advantage I can get and what I lost?
Thank you.
|
|
|
|
|
It is my understanding that C#, being a garbage collected language as Java is, does not have destructors.
What's funny about this is the not so commonly acknowledged fact that destructors are a programmer's friend cause they assure proper releasing of resources acquired during construction, regardless of the flow of control (exceptions included). So, not having to worry about memory leaks (which is what garbage collection is for, and what forces the absence of destructors) imply having to worry too much to avoid other types of leaks. Have you ever seen a robust snippet of code in Java (C# should look alike) managing with say SQL connections dealing with proper shutdown of those connections? Man, you got to put all the closing code on a finally statement, and moreover every closing statement wrapped by try{...}catch(Exception e){} things.
Lacking destructors often results in classes with open/close methods with which the programmer has to mimick what a compiler could achieve with constructor/destructors (and not forgetting to invoke a destructor method as a programmer is likely to).
In C++ nothing of this type happens, provided you are reasonably disciplined (or use properly destroyed classes) and stick to the Stroustrup's motto resource acquisiton is initialization (RAII).
Just wanted to know your opinions on this subject of C# lacking destructors because of the alleged merits of garbage collection. Also, as I'm no expert in this language some of you might know of additional techniques in C# to achieve the effects of RAII.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
C# does provide finalizers, which are run before an object is collected. This means that cleanup is a matter of timing (ie is the cleanup done early enough), not whether it gets done at all.
C# does provide the using statement, which wraps usage of a resource that implements IDisposable (the design pattern for classes that hold onto non-memory resources) in a try-finally for you. This works well for short-lived resources, but for longer-lived ones, you are going to have to track the lifetime yourself, just as you do in C++.
|
|
|
|
|
Regarding your statement about "using" and "IDisposable": I search through all MSDN-documentation that comes with Beta 2 and found nearly nothing about that topic.
Would you be so kind to provide a link or a short example?
--
See me: www.magerquark.de
Want a job? www.zeta-software.de/jobs
|
|
|
|
|
I'd try this post.
http://discuss.develop.com/archives/wa.exe?A2=ind0010A&L=DOTNET&P=R28572
|
|
|
|
|
Well, it is not really a problem, I think that in c# also exist something
like System.gc() ( the garbage colector calling function), You can call it
any time you want.
|
|
|
|
|
(This is a one time announcement in the hope that it will be of interest to the folks in this discussion group.)
I am pleased to announce that my newest book, Programming C# (O'Reilly & Associates, 2001) is now available. You can read the Table of Contents, Index and a sample chapter, and you can purchase the book through Amazon Affiliates, on my web site: http://www.LibertyAssociates.com where I also provide the source code, errata sheet and FAQ.
Thank you.
-j
-------------------------------
Jesse Liberty
Liberty Associates, Inc.
.NET Training & Development
http://www.LibertyAssociates.com
|
|
|
|
|
I read part of this book on the way to a Microsoft conference about .Net. Since then we have purchased another copy of the book to share around the office. Pretty good book.
Its always nice to get started in a printed document then hit the ground running with online examples and tutorials. Microsoft has included some great tools in .Net, the WinCV program is my fav.
Nice book Mr. Liberty. I suggest ppl start with this book, its very solid.
|
|
|
|
|
Nice book, this one is a keeper. Just please don't EVER do one of those "Teach Yourself Particle Physics in 21 Seconds" books again.
"Faith is believing in something you know isn't true."
- Arthur C. Clark
|
|
|
|
|
|
string s1 = "Hello";
string s2 = "Goodbye";
if (s1 == s2)
{
// strings are equal.
}
|
|
|
|
|
That does not work in C#.
You need to do this:
if (s1.CompareTo(s2)==0)
{
}
0 they are equal
-1 s1 < s2
1 s1 > s2
check the help file
|
|
|
|
|
Comparison of strings in C# is value comparison.
if I say:
if (s1 == s2)
that will be true if the strings have the same contents.
If I want reference comparison, I need to use:
if ((object) s1 == (object) s2)
That forces the compiler to use object.Equals() rather than String.Equals().
In languages that don't support operator overloading, you'd use:
if (String.Equals(s1, s2))
|
|
|
|
|
Dear Friends,
which are the better books for asp.net and c# combination?
__________________
s_vrajesh@yahoo.co.in
|
|
|
|
|
Dear Friends,
which are the better books for asp.net and c# combination?
__________________
s_vrajesh@yahoo.co.in
|
|
|
|
|
What is C#?
Could you tell me?
Thanks.
HuChJ
|
|
|
|
|
C# is a new language shipping with the next edition of Visual Studio. It has several goals.
1/ Reuse the code from J++ now they can't pursue that anymore
2/ Stick it up McNealy/Sun by having their own language which has a published standard
3/ Make it easier for VB users to move to a language that is almost, but not quite C++
4/ Kill cross platform development by discouraging C++ programming for Windows
Generally I can't see the point of it, the world certainly needs C# slightly less than it needed Java.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Wow, bit of unbridled hatred there huh Christian
4/ Kill cross platform development by discouraging C++
Really? Why is C++ more cross-platform compliant? Have I been misled in thinking that .NET with C# actually makes the cross-platform development a bit easier (well at least until someone ports .NET to the other platforms of course.)
3/ Make it easier for VB users to move to a language that is almost, but not quite C++
Well isn't that a good thing? I am a VB programmer (put down the rocks and flail pls! ) and am really chuffed that now with C# I can get so much power but not have to waste my time learning a frustrating language like C++. I want to build solutions, not wrestle with syntax and conventions.
But I agree with the whole "C# is Microsoft's Java" sentiment, but is that so bad? My short lived experience with Java was frustrating, not because of the language but because of all the dependencies and VM hassles. Getting it to work cross-platform was like trying to get a VB programmer into C++, bloody difficult. Lets hope once .NET has been ported things will work seamlessly.
Anyways, I just feel that C# is a good thing and will result in better solutions.
regards,
Paul Watson
Cape Town, South Africa
e: paulmwatson@email.com
w: vergen.org
|
|
|
|
|
I completely agree with Christian Graus.
C# (or any other .NET 'dialect') tries to improve code quality by eliminating some typical pitfalls of C++. Which is a good idea, no doubt; the resulting applications won't crash that often. But i think the *real* problem is that the necessary skills needed to build up stable and clean C++ applications are the same skills needed to build a effective, stable and well-designed application using *any* language whether it has for example a GC or not. Again, i do not doubt the usefulness of C# or the whole .NET basics; but i do doubt it will increase quality of code; IMHO it will need even more discipline to build sophisticated applications.
Signature? What is a signature?
|
|
|
|
|
Thank you - this is the point I forgot to address, and it's the most important one. Making it easy for a pleb to bring up a Window and submit data over the web gives a false sense of accomplishment if it means people forget to learn things like good design and good coding practice. Who is more likely to have learnt such things, the person who learned C++ because it's powerful, or C#/VB because it's easy ?
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I agree with you, just giving the world a good tool does not mean it will be used properly.
But I do believe that providing a tool which is both easy and powerful will allow good programmers to push the development of good solutions even further. It will also make it easier for poor programmers to make even worse programmes, naturally.
In my eyes with C++ one has to spend too much time preparing and cleaning up rather than focusing on what is truly important, the functionality and design. Clean up and preparation should be an automated and automatic part of the system. In a way you could say that C# provides a solid base from which one can focus on the solution code. Why do we have header files and classes etc? All those things one has to do in C++ over and over you try your best to put into some kind of reusable code base from which you work on your next project. C# now provides all those common headers and classes out of the box.
Microsoft has learnt from many years of C++ development the pitfalls and also the great features, the wonderful and amazing power of C++ etc. Now taking into account modern day development they have created something which I believe is exposing the best of both worlds.
Bottom line though? I reckon C++ programmers should stick with C++, it is a great tool and ditching all that code and resources just for some new fancy language is a bad idea.
IMHO new programmers or VB programmers looking for something more powerful would be wise to go with C#.
I am sure when C and C++ came along programmers all around the world had arguements like this "but damnit Jim! C++ is so easy and will result in swaths of poor code, lets stick to Assembler it is the best".
regards,
Paul Watson
Cape Town, South Africa
e: paulmwatson@email.com
w: vergen.org
|
|
|
|
|
and another of the main reasons for .Net was to help with coding for those building for both 32bit and 64 bit versions of windows without requiring code rewrites, as everything is compiled to MSIL with it's common type library, all is requires is a .Net compiler and framework on the target platform to convert this to native code and allow it to run without code changes.
BTW: A .Net Framework that runs on Java is underdevelopment, this should mean a version of .net could run on any platform/os that supports Java.
|
|
|
|