|
hi all,
I want to open microsoft outlook from c# windows application,(and i will pass the To email, subject, content as parameter)....
please help me how can i do that??/
thanks all
|
|
|
|
|
You could use mailto , it works with Process.Start which is nice, and you even use it exactly the same as in html.
Example:
string subject = "?subject=My Subject";
string body = "&body=The first paragraph.%0A%0AThe second paragraph.%0ANew line.";
Process.Start("mailto:cheese@sandwich.com"+subject+body);
You don't need to split up the string, it just makes it a little easier to manage.
Oh yeah, and just a simple title like "open outlook with c#" would have been nice, we alread know you want help and I've no idea what the hell those extra E's are for, infact all those axtra letters are going to get you less help.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Couple things. First, pick a better subject line. Secondly, get rid of the , and last of all, you may want to look into the Office Interop Library about working with Outlook in C#...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi to all the CodeProject gurus. I'm quite new to OOP and C#, and when I face a new design problem I wonder if there could already be a "standard", commonly used way to solve it, but I don't have enough experience with C# to find it
The problem: I'm writing a class which parses incoming data bytes from the serial port looking for messages of a particular communication protocol. So, my parser works inside the SerialPort DataReceived event, processes all the incoming data and, when a new message is found, should be able to communicate it to the client application.
My questions is: Is there a commonly used approach to pass data to the other classes, in this kind of situations?
I was geared towards using a Queue of messages, so that new messages are added to the queue from the parser - myQueue.Enqueue(message) - and "consumed" by the application, which sits in a loop like:
while(true)
{
if(myQueue.Count != 0)
{
message = myQueue.Dequeue();
}
Thread.Sleep(10);
}
Is there any better way? And is this thread-safe? I remember that DataReceived works in a different thread from the main application, so I'm not sure about the call to myQueue.Count .
Thanks in advance and kind regards,
Andrea
|
|
|
|
|
I think this approach is Ok, but polling the queue every 10 ms is not a good idea, instead you can create a event in parent class (which holds serial port), the client(the one which is having while loop) can register for it, as soon as the data comes in SerialPort DataReceived event trigger the custom event to client class!
|
|
|
|
|
Thank you for the suggestion, I ended up with an event driven approach as you suggested, and I'm passing data from the serial port event to the main thread using a mailbox based on an AutoResetEvent.
Regards,
Andrea
|
|
|
|
|
Winform program,
How to complex sort of the treenodes?
such as, friends list of IM, the friends online are top always.
even according to the status of different(online or offline) sort of Text.
How do such a tree control with C# in WinForm?
|
|
|
|
|
You have to do the sorting yourself by associating a comparer with the tree nodes. You could also do this by not sorting at all and adding tree nodes in the correct order.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
yes, i think the best way is that you add the information to you ListView sorted, not to add them then acting the sort.
you have to propose a void refreshScreen() method for this that refreshes the ListView and imports the updated status.
so, clear your ListView and them add the sorted information.
|
|
|
|
|
im trying to get the dropped path for hrs but didnt get anything that can do, when i drag item from listview and drop to anywhere, i want the path of that place, any idea how?
thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
no thats not i need, i want to extract the file to somewhere else in hdd in any folder, like Desktop, those articles dropping only in the app or ordering the rows, i want something like Rar, that we can drop the compressed selected files anywhere in hd
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i just know that this is not an impossible one (who doesn't? ). try to catch the answer and post your results to this post and learn us, too.
thanks
|
|
|
|
|
yes only if i get the solution xD i'm searching on this around one and half day but didnt find anything yet
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I read with great interest the article on Building a Generic Range Class[^] (and this second article[^] on the same subject).
I learned more thinking about and designing objects like that than all the dogs-are-animals-porche-is-a-car-has-an-engine books on OOA/OOD put together.
Does anyone know of any other Classes/articles on similar concepts I can study/incorporate into my programs? I'm looking for tool-box type classes that would be used in virtually any application. I'm more interested in middle-tier classes that work with general programming constructs rather than classes that help with GUI's and databases and such.
I hope my question makes sense.
|
|
|
|
|
Like this? http://www.codeplex.com/NGenerics
|
|
|
|
|
I want to insert code snippet for Console.WriteLine().
I type the characters cw and pressing ENTER or TAB. But nothing is happening.
When i type the characters cw intellisense shows me that this is code snippet for Console.WriteLine(), but either by pressing TAB or ENTER i can only see cw written.
Yes, i can explicitly invoke the "insert snippet" menu and select my snippet. But i want to insert snippet quickly during coding without invoking menu. Please tell me how to do so ?
Imtiaz
|
|
|
|
|
After typing "cw", hit tab two times.
|
|
|
|
|
Excellent, like the original poster I'd never understood how to do that. It's so easy when you know how!
Alan.
|
|
|
|
|
Yes, it's very easy. The most used one by me is "prop" for creating a property structure.
|
|
|
|
|
What about this use of generic base class und generic polymorphism ?
I found on the internet some Articles wich deal with generic base class and polymorphism but not in the following way. I know its not possible at the momenten but it should, i think.
Lets say we have class declarations like this
public class Range<T> {
public T Start { get; set; }
public T End { get; set; }
}
public class IntRange : Range<Int32> { }
public class DoubleRange : Range<Double> { }
public class DateTimeRange : Range<DateTime> { }
then we could use it in this way
Range<> range = new Range<float>();
range = new IntRange();
range = new DoubleRange();</float>
and so far the T contrain is naked then the compiler should assume the Property are from Type Object.
range = new IntRange();
object obj = range.Start;
int obj = range.Start;
int obj = (int) range.Start;
or the T contrain is limited to a inheritance of ValueType.
public class Range<T> where T : ValueType {
public T Start { get; set; }
public T End { get; set; }
}
...
range = new IntRange();
int obj = range.Start;
So i think that should be possible, or what you think ?
|
|
|
|
|
Anything that puts us back in the world of essentially containers that are not type safe, is bad IMO. You may as well create a collection of arraylists, if you're going to cast them anyhow
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
No, its not possible. Range< int > and Range< float > are two completely seperate types. I went through the basic reasoning in ( http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2612653 ) that thread.
If you do want them to inherit from a common base then make it explicit: class Range< t > : BaseRange.
I think you might be a little confused when you inherit IntRange : Range< int > - you would only need to do this if you were adding extra int specific functionality.
Edit: Damn, need to remember to add spaces for < and >
modified on Saturday, June 28, 2008 11:31 PM
|
|
|
|
|
Mark Churchill wrote: No, its not possible.
that's right, its not possible, but it should be, in my opinion.
Mark Churchill wrote: Range< int > and Range< float > are two completely seperate types.
that's right as well, that's why IMO there should be a posibility to use generic classes as basis.
List<> list = new List<>(); By the way i forgot to declare the Range<T> class as abstract. Its just a base class and must
be inherited because we can not implement some methods, for example IsBetween(T value);
Range<> range = Range<>();
range.Start
range.End
range = new IntRange();
range.Start
range.End
range = new DoubleRange();
range.Start
range.End
Mark Churchill wrote: class Range< t > : BaseRange.
What would that bring?
The property Start and End would be ever from the type Object and can't take another type, except we override them with new.
|
|
|
|
|
I'm not sure where the percieved benefit of having a concrete IntRange deriving from a Range< T >. Generics are specialization, not inheritance. Sometimes covariance/contravariance (always forget which way those go) is appropriate, but it generally leads to breaking type safety. As generics are generally used to provide type safety then you would be defeating one of their main purposes.
I would suggest the correct way of implementing and using a generic Range class would be along the lines of:
class Range< T > where T : IComparable< T >
{
T Start;
T End;
bool IsBetween(T i) => Start.CompareTo(i) < 0 && End.CompareTo(i) > 0;
}
Then the usage is trivial. No need for an abstract generic class with concrete types.
|
|
|
|