|
The simplest solution is to just use a RichTextBox: add your RTF string to it; and, read back its 'Text Property:
YourRichTextBox.Rtf = YourRTFString;
string YourPlainText = YourRichTextBox.Text; Or, you could use this:
private char[] cleanRTF = new char[] {'\\', ' ', '{', '}', '\r', '\n'};
string[] sAry = str.Split(cleanRTF, StringSplitOptions.RemoveEmptyEntries); But, then, you've got to do something with the resulting string[], like combining it back into a continuous string, in which case you will still have lots of the RTF formatting codes.
For more sophisticated "cleaning" you should consider using a RegEx; but even that is not easy, as you can read about here: [^].
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
|
Am back again with another issue in my tool.
i need to grade out a text box, on selecting an option in a combo box drop down.
A part of my tool looks like this:
Label1 (Status) Combobox1 (In-progress, On-Hold,
Label2 (Result) Combobox2 (Pass, Fail)
i need the Combobox2 need to be Disabled only when i select "In-Progress or On-Hold" in the combo box1
i tried with implementing checkbox instead of combobox (if checkbox1.checked = true) etc. it works.
But i donot want to implement the same using combox box.
please assist.
|
|
|
|
|
And what is the problem?
You clearly know how to disable a Textbox, and you presumably know that the ComboBox has SelectionChanged events - so what part of this do you need help with?
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Try this:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox2.Enabled = ! (comboBox1.SelectedItem == "In-progress" || comboBox1.SelectedItem == "On-Hold");
} Here the assumption is made that there are other selectable Items in comboBox1 which, if selected, should enable the use of comboBox2.
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
..how to grab coordinates from video screen and automatically save the longitude and latitude then it,,this coordinates will be used for mapping..pls. help me.
|
|
|
|
|
Your question is too vague. What screen are we talking about here?
/ravi
|
|
|
|
|
Hi all, I'm pretty new to C# and would like to have some questions answered regarding getting data from the user. Suppose I have a class called MyClass like the following:
Class MyClass
{
string firstName;
string lastName;
MyClass(string fName, string lName)
{
this.firstName=fName;
this.lastName=lname;
}
public string fN{ get { return firstName; }set { firstName= value; } }
public string lN { get { return _firstName; } set { lastName= value; }}
}
Then in the code behind of my aspx page I want to create an array of type MyClass and get firstName and lastName from the user and put them in the array.
I plan to have the user enter firstName and lastName into textboxes and insert them into the array by sending them in as parameters during the instantiation of the array. The following is what I have done but it does not work.
MyClass[] projects = new MyClass[4];
projects[0] = new Project(firstName, lastName);
Any help is greatly appreciated, thanks in advance
modified 9-Feb-14 3:08am.
|
|
|
|
|
No, it won't work.
Or rather, it will - but not for long.
The problem is that you aren't thinking website - you are thinking desktop.
Websites do not work in the same way: the application is not running all the time, waiting for the user to do something. Instead, the website application is started again each time the user does something like request a page, press a button, and so forth. Which means that unlike a desktop application any data you assemble in your application ceases to exist as soon as the last bytes of data have going back to the client. If you don't store it somewhere permanent (or semi-permanent) explicitly, it is discarded, to make way for the next website / user combination.
If you want to keep a list of users, then you need to explicitly save the data, in a database, or in the Session, or in Cookies, depending on how permanent you need it to be.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
hi
Want to write a example of textbox other windows with SendMessage API
thank
|
|
|
|
|
Don't post in multiple places: it duplicates work and that's annoying.
You posted this in QA, so leave it there.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Hello Guys,
Am struck with a scenario here,
Am going to distribute my Front End tool developed using C# to 30 users computer.
They will be entering the values in it and that will be get stored in the SQL database in the Server location.
I want the computer name of users to be captured in the Sql database automatically with the user entering that value.
e.g:
User 1 will be entering the below details from Machine 1.
My Sql database will be getting the values entered by user 1 and additionally in one more column i want the "User 1" also to be captured.
(Can we use "LoggedOnUser" something like that retrive the userName to be entered on Clicking the submit button) ??
Same for Date also, Can we use "SysData" to be getting captured in Database
Please assist.
|
|
|
|
|
The user is easy:
string username = (string) WindowsIdentity.GetCurrent().Name
Getting the date is even easier:
DateTime now = DateTime.Now;
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
and Environment.MachineName in your client code will get you the computer name.
|
|
|
|
|
You now have the methods and keywords to use.
So your app needs to pass in the user name when it sends the data to the database. Every table in my databases has a Modified and ModifiedBy field and that information comes from the client application.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As an alternative to the above answers, if you want to do this from SQL, you can use the HOST_NAME[^] and SUSER_NAME[^] functions to get the computer name and username.
For the current date and time, you can use the SYSUTCDATETIME[^] function. (This will return a UTC value, which is the only sensible way to store times in a database.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hello guys i need ur help if i have data table
item value check
a 11
a 10
b 9
b 30
c 10
---------------------------------------
i need get the min value of item ech item as like that
item value check
a 11
a 10 x
b 9 x
b 30
c 10 x
|
|
|
|
|
This looks like homework. Show what you have tried and explain your problems.
To get you started here is one possible way to get the minimum values.
Loop through the rows and store the minimum value for each unique "item" value. You can use a Dictionary<string, int=""> to store these unique items and the value. If the Dictionary contains the "item", test the value and store the minimum value; if it does not contain the "item", add it.
This is not the complete solution, so do not come back and say its does not work.
|
|
|
|
|
Do some research into GROUP BY and the MIN operator
Select Item, min(value) from table
Group By Item
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hello All,
I'm looking for a way to connect to a Cisco Router via SSH and then interpret the output to perform different operations based on the output, i.e. username/password incorrect, enable mode, etc ...
I have already been able to achieve this using TELNET, but now I need to migrate to SSH.
Best Regards,
Sikas.
|
|
|
|
|
|
I already searched, but didn't find anything useful!
Best Regards,
Sikas.
|
|
|
|
|
There were lots of links in the search I did. And given that your question lacks any real detail it is impossible to offer anything more.
Veni, vidi, abiit domum
|
|
|
|
|