I have updated my RichTextBox but i can't get it to redraw.
I have tried several ways but the only one that somewhat works is to SELECT the data that is being updated .. but that has the nauseating effect on the User of causing the entire RTB text to scroll ... bad bad bad.
(no human input is involved in updating the RTB ... 183 lines are updated in microseconds ... unless SELECT is used ... then it takes a second or so)
The RTB gets updated just great, but i can not get it to redraw.
private void UpdateRemainingTimes()
for (int n = 0; n < numReminders; n++)
string remainingTimeStr = GetRemainingTimeString(remDate[n]);
int lineIndex = ReminderRTB.GetFirstCharIndexFromLine(n);
int indexToDDD = lineIndex + 16;
ReminderRTB.Text.Remove(indexToDDD,remainingTimeStr.Length); // delete old stuff
ReminderRTB.Text.Insert(indexToDDD, remainingTimeStr); // put in new stuff
ReminderRTB.Invalidate(); // ??? does not cause the control to be redrawn ???
I am designing a windows service to communicate with an application that has been written. The objective is to be able to send a notification message from the application(written in C#), to the windows service(also being written in C#). Once the service has recieved the message and processed it, It would send a message back to the application specifying whether or not the process completed successfully. I have been scouring MSDN and code project for articles on this topic, but I haven't been able to find anything relevent. I have a feeling I am not using the correct keywords. Can anyone point me to an article? Thanks
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
MSMQ is good if you need a reliable message passing system. This means that you cannot loose messages between the client and server (in either direction) if one of them is down. It usually is overkill for most things.
You need to look at creating a service that understands how to talk through the .NET remoting channels or use WCF. Using WCF is much simpler, but adds a dependency on .NET 3.0 or later.
Scott. —In just two days, tomorrow will be yesterday.
My application has a class CUser which represents a user. The application serializes the user object to XML like this:
CUser aUser = new CUser("firstname", "surname", "address");
XmlSerializer serializer = new XmlSerializer(typeof(CUser));
StreamWriter streamWriter = new StreamWriter("user.xml");
I've been asked to have the user details encrypted so people can't casually look at the user details. From the above I'd like to encrypt the XML strings as they're written to the file but is there an easy way of doing it? It seems that it would be convenient to have the data encrypted by the StreamWriter and then decrypted by a StreamReader. I'll need a password so how do I manage that within the application?
Hmm, you could serialize it into a memory stream, read out the stream into an array of bytes, ecrypt the bytes with one of the built in classes or whatever, then write the encrypted array to file. And of course if the data structure becomes to large to just dump into a memory stream, you could use a filestream and create a temporary file, just remember to delete the temp file.
That just seems a bit much effort to me but...
There's probably a simpler way, but ive never used xml with c#, and i have no idea whats there. Infact, i only ever used encryption once.
I don't have something smart to say regarding XML encryption,
But i want to mention something else regarding XML Serialization.
when you are using the XmlSerializer in order to serialize XML it create temporary dll that contain the serialization logic code.
In my experience i saw that it is better to use a pre compiled serialization logic code in two dimension
you can create pre compiled serialization logic code by using the sgen.exe tool