|
Hello D@nish,
First of all i would like to thank both you and Riced.
I have found the solution to my problem and its still kinda strange.
There was actually two problems;
- for some strange reason I cant declare my RegEx string using a literal (using @ when assiging the string) if the literal spans multiple lines, for some reason this is messing with my RegEx.
Which is why i guess in your example its working.
- the emails are being retrieved from Exchange via WebDAV and for some strange reason line breaks are only coming back as '\n' not '\r\n' like they should. So if I do a .Replace("\n","\r\n") on the body everything works fine.
I guess this wasnt a problem for your in your example because the email body was assigned as a literal and therefore had the "proper" line breaks (\r\n)
Thanks again for your help guys, i never would have found this without your help.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Great!!!
|
|
|
|
|
Instead of doing a string.Replace, you could also change (?:\r\n)+ to [\r\n]+ , which should match any kind of newline
|
|
|
|
|
I assume that you are setting some variable (e.g. myRE) to the regex string.
Are you using a verbatim string i.e. myRE = @"Lead....(\r\n)+" or just doing myRE = "Lead...(\r\n)+" ?
I think it should be a verbatim string otherwise \ is interpreted before Regex.Matches sees it.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Thank you for your reply.
Yes it is "Verbatum" assinged using @
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Just noticed that there's no test for "===========" after the Lead line.
Is that the problem?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Hi David,
You are right, nice catch.
However that shouldn't effect the matching.
Now I did solve my problem, look above for the solution.
Thanks for your help.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
hi friends
i need a html editor for my application
but i didnt find. i have some editor base on web application but no one can use in windows application
do u know a html editor that can use in c# application(windows base)?
please help me
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Do you want to create html file or HTML help files with .chm extension? Please verify that!
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
Hello,
You should take a look at the DesignMode property of the WebBrowser Control.
If you switch it to "on" it turns the WebBrowser Control into a WYSISYG (What You See Is What You Get) editor.
Then you can get the HTML from the WebBrowser Control.
Check out this great article on how to use the WebBrowser Control
Using the WebBrowser control in .NET[^]
|
|
|
|
|
my friend thank you for ur reply
but i need a html/text editor like gmail editor for writting message but with bit different and the different is that i want use this html/text editor in my windows application project.(c#.net)
in this article i didnt see some place for input html source or editing source with toolbar menu like office
are u sure that this article is usefull for me?
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
The article will show you how to place the a WebBrowser control onto your form, and it shows you how to switch DesignMode "on".
After that all the other functionality (i.e. editing source with toolbar menu like office) you would have to build yourself.
You can access the complete HTMLDocument by using the Document property on the WebBrowser control then use that to insert elements from your menu.
More info on the WebBrowser: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx[^]
|
|
|
|
|
thank you for ur reply
i am going to test it !!!
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Hi Friends,
I need to know that, is it possible to print '"' on the Console? I try to do this by this code: System.Console.WriteLine(""");
However, this doesn't work because declaring a single " marks the beginning of the string and declaring another " marks the end. Whatever be it, please tell me whether its possible to print (") on the screen? {excluding the () brackets}
Cheers,
Rajdeep.NET
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
Yes it is, simply do
System.Console.WriteLine("\"");
|
|
|
|
|
Thanks Vestras,
It worked!
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
|
|
I'm trying to roll up some old (originally .net 1.1) abstract classes into generics. The classes in question all provide similar functionality for a data object of a specific type. For the most part things are going well, but I've ran into a few places where one one of the data objects is of a type that needs extra processing in one method beyond what all the other types need. I can check the type of T to see if it's the type I need to do the special processing for, but the cast from T to SpecialType won't compile. Is there a different way I can do this, or is what I want to do impossible?
class MyGenericClass<T> : ICloneable where T: class, new()
{
private T m_storedClass;
...
private DoStuff()
{
if (typeof(T) == typeof(SpecialType))
{
((SpecialType)m_storedClass).SpecialString = "foo";
}
}
The European Way of War: Blow your own continent up.
The American Way of War: Go over and help them.
|
|
|
|
|
I am working on a C# application which accepts users information including their photos. So can you tell me the code how to store this photo in a data base......................... in the database there is a table called Personal ..................... and there is a column called photo(its data type is Image) which helps me to save a picture .............. Help me please........ Thank you
|
|
|
|
|
There are hundreds and hundreds of solutions to this problem on the web just search for save image to database c#.
To narrow the search a little replace 'database' in the search term by the name of the database you are using e.g.sqlserver.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello,
I am new to C#. I would like to read a line of data which contains several items separated by spaces, e.g.
10 20 30
In C++, I would accomplish this by infile>>num1>>num2>>num3
However all of the examples I have seen in C# are for reading an entire line of string data.
Any help would be appreciated.
|
|
|
|
|
It really depends on the exact format of your data, but if your example is an accurate representation, then two approaches spring to mind.
1) as the examples you have seen do, read an entire line into a string (call it dataString ), then
string[] numbers = dataString.Split(' ');
foreach (string s in numbers)
{
someIntVariable = int.Parse(s);
}
2) BinaryReader has a ReadInt32() method. Which can be used, for binary streams, obviously.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you so much it worked.
|
|
|
|
|
Hi all,
I have an MDI window with a ButtonBar (defined as master) and from there I can call the child windows (outside the master).
And from one child window I am calling an DialogWindow.
And here comes the problem:
When I am closing this dialog window, the FormClosing event (of the dialog) fires 34 times, and after that the FormClosed event fires 10 times.
I am shure that the events are only initialized for one time.
So you can say that 3 layers are opened. (MDI-Master --> MDI-->Slave --> DialogForm)
It wouldn't be a problem at all, if the dialog window wouldn't hang up. The whole Program stops.
in the FormClosing method is only a quiet simple code.
Dialog_FormClosing(.....)
{
try
{
Console.WriteLine("closing");
if(!can_close)
{
Messagebox.Show("You have to finish your app first");
e.Cancel = true;
}
else
{
e.Cancel = false;
}
}
catch
{
}
}
The question is: Why fires the event so often ?
And why hangs up the dialog (the dialog does not close)
Some ideas ? - using .NET 2.0.xxx
Tnx
Frank
|
|
|
|