1.in my Winform a make a remote call to the process and ask him to give me the list of all printers installed.
2. show the output in a lisbox for exemple.
We can abstract the question to "how do I get data from PC1 to PC2". The recommendation would be to look into WCF, but any type of exchange-mechanism would do- there's examples on communicating using sockets, but it'd even be possible using simple files.
Are the computers on the same LAN? If yes, I'd go for a simple socket
i would like to execute this code on a remote computer and get the data back to my winform.
Then you will need to write something to do that communication, or use an existing solution
You could also adapt the console-example to suit your needs, hence the link. If that's too much trouble, then you'd have to map a network-drive from the server, and use a batch-file to write the result to a file on that network-share. E.g.;
You're probably doing something wrong. I just tried it and had no trouble at all. Xml is perfectly capable of storing the text and giving it back.
You would need to show us the code you are using to determine what's wrong. Whatever the problem is, Replace isn't the best solution. Even if you think Replace is "good enough" for the particular program you're working on, it is not a good general solution and finding a better one will help you become a better developer.
P.S. What you posted will not produce well-formed XML if the user enters characters that aren't allowed. Try something like:
This read text from text box and ads xml tags, and makes string strContent. Where are this "know how to" read text with only LF? This read simple Text property form text box. Since text box
use CR+LF this read text with CR+LF? So why he wrote that he only "know how to" read only LF? Where is sense in that?
More. Line above text you quoted he wrote
Because this is a paragraph, so the text value of the text box will include characters like: "\r\n" and "\r\n ".
So he wrote that text box have CR+LF, then in next sentence wrote that he only "know how to" read LF and pasted code sample with reading text box with CR+LF chars.
Where is sense in that? There is non.
Obviously is writing some king of app to edits XML content with only LF, and from text box gets CR+LF.
You would get to the same if you would spend on it more than half a minute, think and do not reply with 'you are bad programmer because you like simple solution'
I did, I wrote a whole database table (SQL Server 2008 R2) and Winforms app in an effort to reproduce the "problem". Did you?
I was unable to reproduce the problem, therefore there must be more information that the OP left out.
For instance, he doesn't show how he gets the strContent into and out of the database, that could be where the value gets messed up. Without more information, a proper answer can't be provided.
You are never humble, do you. Who are you to to tell what answer is "proper"? Do you know everything?
If someone is happy with solution do you have to force him to change his mind?
1. Text box returns "\r\n" in content
2. Content must be inserted into xml without "\r"
What is "left out"? That's the problem.
What about solution.
Why I waste my time discussing anything with you, self proclaiming, uber-programmer. Maybe in you world overcomplicating thinks is good thing. Not in mine.
Ah, so that's how you're interpreting it. I interpreted it as the OP wants to store the \r, but for some reason it's getting lost along the way. As I said, I was unable to duplicate the problem. If, as you say, he wants to not store the \r yet get it back again (and I have no idea why that would be), then I would still have better suggestions than Replace.
At any rate, until the OP responds with a clearer explanation of the situation you and I could continue to debate it and neither of us wants that.
Maybe in you world overcomplicating thinks is good thing. Not in mine.
Solving the problem rather than sweeping it under the rug to cause trouble down the line is what I consider a good thing.