|
Hi reinux,
thank you for your reply,
I simply want to copy the contence of one richtextbox to a second one, with the additional task that the first one exists in a dialogbox were the contence will be modified. By closing the dialogbox the contence should be given to the second richtextbox with all properties which exist within the dialogbox-calling class - It seems to be a simple class copy .....
Quite simple, but doesn't work in my way.
Some idea to what's to do
Thank
Frank
|
|
|
|
|
If you want to copy just the text, you can copy the Rtf property of the text box, like:
textBox2.Rtf = textBox1.Rtf;
That'll preserve all the formatting.
I hope I understood you correctly this time, tell me if I'm wrong
|
|
|
|
|
Hello friends, I need some help, please
I need of routines to encrypt and decrypt small amounts of text (max of 64 chars).
I wish what this routines return an fixed-lenght encrypted text, by example, 64 chars too, and I can decrypt too
The crypted text need be in base64.
How I can achieve this?
Regards
|
|
|
|
|
|
I have a large byte array which I used to intialize by reallocating but the array can get rather large and my app can generate quite a few of them and it was causing a lot of paging so I decided to reuse the arrays instead of reallocating them but I need to reinitialize the array, is the following correct?
<br />
<br />
[System.Runtime.InteropServices.DllImport("kernel32.dll")] <br />
unsafe public static extern void ZeroMemory(System.IntPtr ptr ,uint size);<br />
<br />
internal void Clear()<br />
{<br />
GCHandle gch = GCHandle.Alloc(_vector,GCHandleType.Pinned);<br />
ZeroMemory(gch.AddrOfPinnedObject(),(uint)_vector.Length);<br />
gch.Free();<br />
}
|
|
|
|
|
In C# I'd just write a for loop zeroing every entry. Calling out to ZeroMemory complicates things.
In fact for most purposes I wouldn't bother zeroing the array, I just keep track of how much of it was used. If, for example, you're trying to convert an array of bytes to a string using the System.Text.Encoding classes, you can use the overload of GetString which takes an offset into the array and a length to convert.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
The ZeroMemory method appears to be much faster than zeroing the array in a loop - according to the DevPartner profiler - the array can be over 1 million bytes long.
|
|
|
|
|
I've had MUCH bigger. It's much quicker (and much less of a hassle) to just kill the array and reallocate it. Everything will be automatically zero'd out for you.
[EDIT]
Whoops! Hit Submit on accident. Just zeroing out the memory won't avoid the problem of paging. In order to zero out the array, it's got to be swapped back in, zero'd, then swapped back out if needed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That's what I thought but it seems to make a big difference recycling the memory like that. The way the app works means 1000s of these arrays could be created and destroyed - recycling it means I only need 3.
|
|
|
|
|
|
The array should generally be kept in memory I would have thought as it is the focus of the proceesing at the time - everything centres around that array - although it's on a worker thread so I can keep the GUI updated with the progress.
I have been messing about with this code for a while now, memory and performance profiling the hell out of it. It's odd what works and what doesnt.
|
|
|
|
|
I need to keep only 1 "in memory", but I had to swap it every now and then between a working array, which grows in size unpredictably, and a source data array, with a static size. Actually, I was using BitArray's. All I did to conserve and compact memory during the swap was to serialize the current working array to disk (believe me, an array at nearly the capacity of a BitArray object!), dump both arrays from memory, force a Garbage Collect, then recreate the source data array from the serialized object on disk, then blow away the file. Worked great and enabled me to eek out a bit more capacity in the process.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using the byte array as a bit array and I need to constanty iterate over it ANDing and ORing it against another byte array. I am creating a 3 way crosstab report and by recycling the memory I only have 3 byte arrays in memory at any one time which give me big savings. The array is basically the number of "person" records on a database divided by 8
|
|
|
|
|
To retreive a thumb of a jpg, reading the complete image file shouldn't be neccessary because a jpg file often has a thumb built in. GetThumbailImage() below is useless because the full image has to be loaded first. Any way around loading the full image file?
Bitmap myBitmap = new Bitmap(strImgLoc);
Image myThumbnail = myBitmap.GetThumbnailImage(100, 80, null, IntPtr.Zero);
Cheers,
Glenn Rogers
|
|
|
|
|
Travelster wrote:
reading the complete image file shouldn't be neccessary because a jpg file often has a thumb built in.
Not in any .JPG's I've seen. The thumb has to be created from the full size image.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello, Sir and Madam.
When drag a table from Server Explorer and drop it to a form The VS.net auto create InserCommand, DeleteCommand, UpdateCommand include with Parameters.
I need to imitate this in my application. Is it possible?
Thank You.
Sorry For Bad English
|
|
|
|
|
Yes. you can also do the same stuff here in your code and can call Adapter Update method to update back to your database.
Just have a look at Command builder calss .
Otherwise you can also create your own update,delete,select and insert commands using Command class and can assign it your DataAdapter.
Eg:
YourDataAdapter.SelectCommand=YourSelectCmdBuyer;<br />
YourDataAdapter.InsertCommand=YourInsertcmdBuyer;<br />
YourDataAdapter.UpdateCommand=YourUpdateCmdBuyer;<br />
YourDataAdapter.DeleteCommand=YourDeleteCmdBuyer;
Please have a look at MSDN for more information.;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
http://www.west-wind.com/presentati...WebServices.asp
i made the sample web service studying from the above link
it was running correctly
after that i made the client that also from studying from the above link i add reference to webservice
let it be service1
after that it is written to add in class header
using service1;
i am not understanding where to add this abovw line
using service1
plz help
ankit
|
|
|
|
|
I need to send a “large” packed of data over TCP/IP using Socket. The data is an Bitmap image and is size is about 50.000 bytes. My problem is that Socket only transfer some of it and then stops.
I guess I need to transfer it in smaller blocks of data and then assemble is when I receive it. Can someone give me a hint on how to do this?
|
|
|
|
|
|
As a side project, I'm rewriting an incomplete debugging tool over to C#. It's nothing more than a fancy RS232/serial port terminal program that displays all text received on the port. The part I'm pondering though, is how to display the incoming text. I'd like to:
- Colorize the text
- Display only X amount of lines. If another line comes in, toss the oldest ones out
- Autoscroll as new lines come in
- Be able to split the display and scroll over the same data
So I can do all this with a Textbox (RichTextBox to be exact), but a couple of things concern me, mainly to do with the fact that the textbox stores the text internally. Splitting the window requires using two textboxes, which would require duplicating the data. With alot of ports open, that could be alot of wasted ram. Second, to ensure only X lines are stored, it looks like I have to grab the data out of the textbox (copying it), remove the oldest lines manually, then replace the text in the box (another copy). Twice, since the window is split. That seems pretty inefficient.
I've looked all over and have't seen any text control that will work without having its own copy of the data. I could write my own, but that's a fair amount of effort as well. Does anyone out there know of one that can be databound and not require copying so much? Or am I just missing something in how the textbox works? This has to be a pretty common scenario so I'm a bit suprised I have not been able to find much info on it..
|
|
|
|
|
what about listView control
ByMindOnlyYouCanDoIt
|
|
|
|
|
I would suggest you start thinking about writing your own. A few ideas:
1. Your UserControl holds the data in an array of string s, with a pointer to the "first line" (a circular queue). When a new line arrives, replace the current first line and increase the pointer. When you get to the end of the array, set it back to 0 (for the beginning.)
2. Create a Panel that draws the information in that array, without duplicating it. It should allow scrolling, coloring of text and everything else you need.
3. Add a Splitter as a child of your UserControl , and two of the Panel s created in #2.
I don´t think it would be as hard as it seems. Probably #2 is the hardest part.
Good luck, and if you do something reusable, think about writing an article for CP!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Yeah, that's where it looks like I need to head. I've gone so far as to disassemble the TextBox code to see if I could bypass anything there. It looks like it wouldn't be too much trouble to derive a class from TextBox that would let me at least read the text directly, but I don't see any way to get around the need to create a new string and put it into the textbox. With a 5,000-line buffer, making a copy of the entire textbox even once every time I want to update the contents seems very very inefficient. It's just a shame that I have to rewrite so much functionality. I'm still suprised that I can't find anything else out there that does this, it makes me wonder what I'm missing...
I thought about the ListView as well.. but cut-and-paste becomes difficult to do there, since I wnat to be able to cut-and-paste like a normal textbox.
Thanks for the thoughts! If I do end up with something usable I'll definately post it here!
|
|
|
|
|
My solution didn't include deriving from a TextBox but writing your own drawing code. But if you need text selection, and copy/paste support, definitely derive from a TextBox .
I don't know if the TextBox makes a copy of the string you use to set its Text property, or just keeps a reference (I'd think it makes a copy). To automatically scroll the text box to the end, set the cursor position at the very end, and done )I don't remember the exact properties). And for the bottomless buffer, you'll still have to make a circular queue as I described in my other post.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|