|
Some systems use a single character (10) as line break, while DOS/Windows uses two characters (13, 10).
You can fix any "funky" line breaks with:
theString = Regex.Replace(theString, @"\r?\n", Environment.NewLine);
This code works regardless of the type of linebreak the current system is using, and it doesn't mess up line breaks in the string that already are correct.
-- modified at 3:18 Thursday 24th August, 2006
Made a correction about what characters are used, and changed the regular expression pattern accordingly.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks. This didn't work directly, but after making it search for just "\n" and replace it with an Env.NewLine that did work.
Strange...
|
|
|
|
|
Right. The square characters that you have is not the carrage return (char 13), but line feed (char 10). I have corrected the code that I posted earlier.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
I have a program that generates some HTML and then needs to automatically print it. This automatic printing occurs within a separate thread (timer) and for the life of me, I just can't get it working.
After a couple of days Googling around, I found a couple of things:
1) Attempting to do it calling IE (or the equivalent DLLs) isn't an option since it'll always pop up a print dialog box and there's nothing that can be done about that.
2) webBrowser1.Print() should work, but doesn't. It doesn't call an exception, it doesn't have any problems, but it also doesn't print. I'm assuming it's related to the fact that this is all in a separate thread from the timer.
3) If I attempt to be "messy" and just call a complete new thread that creates the webbrowser object, loads the HTML and print it, it gives an exception complaining it's not STA, even though I did set it that way.
So basically, I'm fairly stuck at this point. Here's the code I've tried so far minus the messy one, since that's definitely barking up the wrong tree I think. (note that the html is both in my webbrowser object or in the file - I'd love to not have to use the webbrowser object if I can get away with it)
<br />
<br />
<br />
<br />
<br />
Ben de Waal
|
|
|
|
|
To clarify further, this code:
YttriumOxide wrote: /* //This doesn't work - maybe because of the thread?
*
* webBrowser1.Navigate(szTempFolder + @"\Temp\Body.html");
* webBrowser1.Print();
*/
DOES succesfully do the webBrowser1.Navigate, but NOT the webBrowser1.Print - which is extremely confusing in my books... Why does Navigate work inside a seperate thread, but not Print?
Ben de Waal
|
|
|
|
|
Hello all,
I wonder if any of you have found/written a free Ribbon Control (the office 2007 style)?
I found some ribbon controls while googling but none of them are free (not even for non-commercial use).
Regards,
Pawel
|
|
|
|
|
I have a c# exe that must tranfere files from one server to another. Well it works perfectly when I am logged on remotely to the server but if I am not logged on it give an error saying it counl not find the destination drive.
How can I make it to run while I am not logged on?
|
|
|
|
|
If you are referring to the remote system's file system using a mapped drive then don't. Refer to it using a UNC path name.
|
|
|
|
|
Could you please explain further. I am not an expert in C#(still learning).
|
|
|
|
|
Colin is suggesting you directly use the UNC[^] notation, instead of mapping a drive to that location. You typically would have used the UNC path to setup the mapping in the first place.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
can i get some unique value when I will press the backspace in the following event
private void richTextBox1_TextChanged(object sender, System.EventArgs e)
|
|
|
|
|
Try it by selecting the keypressed property for the textbox then checking when backspace is pressed. You KeyPreview should also be true i think.
e.KeyCode = BackSpace
or Back or something like that.
|
|
|
|
|
Only on TextChanged event not in key press
|
|
|
|
|
No.
You get what the event's name is indicating: The Text property has changed, nothing more, nothing less.
For example, if your cursor is at the beginning of the text, pressing Backspace will not modify the text, so no TextChanged event will occur.
To find out how the text has changed you'll have to save the previous version of the text and compare it with the new value.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi there, can anyone please help me? I wrote a program with a deployment project too. How can i add a sqlconnection setup during the deployment / installation of the program ? Thanks in advance.
|
|
|
|
|
Why do you need to create the connections tring at setup time?
You can create a custom action in your install package to write the connection string.
only two letters away from being an asset
|
|
|
|
|
I dont know what the client's datasource address is so i want him to be able to enter it on setup of the website.
How does one create a custom action in your install package to write a connection string?
|
|
|
|
|
|
Im sorry but i can't find anything in custom actions that i want to get a connection string from the client during the installation.
|
|
|
|
|
Create dialog to display within your install package asking the user to supply connection string details. Use a custom action, possibly of type 2, to run an exe that adds this info to the config file.
only two letters away from being an asset
|
|
|
|
|
Hello !
Is there a way to make modeless dialog top most/always visible without using
TopMost=true ?
Because if we click button to show modal from this modeless dialog, they always stay at back.
Thank you.
Sovann
|
|
|
|
|
Hello,
Maybe, "BringToFront" can Help you.
All the best,
Martin
|
|
|
|
|
If you set your main form to be the Parent, it will never go behind the parent, but TopMost is the only way to make it topmost.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello,
Thank you for your advice. I have tried them all but
1. BringToFront() didn't solve the problem
2. set_Parent always complain 'cannot add top level control to this control'
I tried :
Dialog dialog = new Dialog(); // TopMost=false
dialog.Parent = mainForm; // set parent to main form
dialog.Show(); // run modeless
Sovann
|
|
|
|
|
Sorry, C# is dumb. It's not Parent, but Owner that you want to set, as it's a top level control.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|