|
"The menu item should just close the form, and the closing event should handle asking if the form should be closed or not"
I have done what you said, it work for me. thanks
|
|
|
|
|
Vikram A Punathambekar wrote: Why are you explicitly calling another event handler?
That's a pet peeve of mine - I've seen code go to extraordinary lengths to call another event handler directly.
|
|
|
|
|
Hey, Senthil, it's been a while. How are you doing, and where are you now? Is your phone number still the same?
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I'm going great, how about you?
I flew back to Chennai a couple of weeks back. And yes, my number is still the same.
|
|
|
|
|
To cancel the event just simply set
<br />
e.Cancel = true;<br />
in OnClosing function.
Anindya Chatterjee
|
|
|
|
|
Hi,
How to get goto functionality in richtextbox...
richtextbox.Find(NextLine, LineNo, RichTextBoxFinds.WholeWord) takes lot of time....any faster way to highlight the line or just get cursor on that line
Regards
KAMALESH
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
Hi Kamlesh,
Please try the following code snippet and see if this helps. The following code shows how to use one of the overloaded versions of Find.
-------------------------------------------------------------------------
BEGIN CODE
public int FindMyText(string searchText, int searchStart, int searchEnd)
{
// Initialize the return value to false by default.
int returnValue = -1;
// Ensure that a search string and a valid starting point are specified.
if (searchText.Length > 0 && searchStart >= 0)
{
// Ensure that a valid ending value is provided.
if (searchEnd > searchStart || searchEnd == -1)
{
// Obtain the location of the search string in richTextBox1.
int indexToText = richTextBox1.Find(searchText, searchStart, searchEnd, RichTextBoxFinds.MatchCase);
// Determine whether the text was found in richTextBox1.
if(indexToText >= 0)
{
// Return the index to the specified search text.
returnValue = indexToText;
}
}
}
return returnValue;
}
-------------------------------------------------------------------------
END CODE
Hope this helps.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Hello everyone!
I am writing a desktop share application that takes screen shots of the screen and sends it to a remote host, where the host can click on the picture and take control of the other person's computer, so to speak.
Everything is working just fine, except I keep failing out after a few minutes due to an OutOfMemory exception. I do not understand why this is happening, as I am monitoring the memory levels of the computers and they seem to be completely fine.
Is there another reason why this error would occur? I am receiving the pictures in a while (true) loop, and at the bottom I always .Dispose of things I no longer am using, and I always make a call to the GC (garbage collector) class so I can free up some memory. This, however, is to no avail.
Any thoughts are appreciated!
-Karl
|
|
|
|
|
KarlWF wrote: and I always make a call to the GC (garbage collector) class
This should not be necessary. But, it seems you are leaking resources somewhere. Perhaps if you posted some code ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yup, avoid manual collection through the garbage collector. You may be inadvertantly promoting objects to a higher generation which makes it less likely they'll be garbage collected the next time you need it. But, overall it sounds like a memory leak.
|
|
|
|
|
Turns out I accidentally had been doing the following each time in the loop:
byte[] data = new byte[500000];
Could that be what was making the exception occur? I admit, when it comes to memory management I am very clueless, as I've not taught myself the inner workings of memory.
|
|
|
|
|
Well that's not it. When I test inter-network with my father, everything is ok.
However, when I connect to my friend 5 miles away, I get the exception out of memory. I am clueless as to why that would make a difference.
|
|
|
|
|
OK - ten I guess you need to consider that it could be related to your networking code ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What I do is on a socket, I do a socket.Receive() and I put it into an already made buffer.
Then I save the buffer to a file, and read the file. I just am so confused as to how testing this over greater distances makes my memory exception come out quicker.
|
|
|
|
|
Apparently, if the image in in "invalid format" it will throw the OutOfMemory exception. I think this is likely the case. I will do some more testing to see if I can rid myself of it. However, I do appreciate the responses.
Thanks again
|
|
|
|
|
Might the code run more often if it's a greater distance ? CAn you log that ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I would think not. With the greater distance means a longer time waiting for the socket to receive data, and with greater latency means more waiting, means less repetitions in the loop I would think.
|
|
|
|
|
I have not seen the code, obviously, but if a greater distance causes it, then I'd wonder if a smaller packet size makes the code run more often for the same file size. Stabbing in the dark, here....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
KarlWF wrote: I would think
Sure, but you would also think your program runs fine, except it does not.
There is a flaw somewhere, it could as well be in the things you think to be true.
Be alert for all kinds of things, gather facts, hence use logging as Christian suggested.
|
|
|
|
|
Hello
I have a problem.
if we have internet connection(gateway connection,not dial-up) for example by a adsl modem connecting to pc by usb, how can we disconnect and connect that connection in C#, i know how to test it's connected or it's disconected.
thank's alot.
pejman
|
|
|
|
|
Hello all,
I have a very simple program. All it does is browse for a file, calculate the sha1 hash and display it in a textbox. I have added an option in Windows context menu with the intention of right clicking on a file, choose an option like 'Get Sha1 Hash' and have the program calculate it. How do I do this? Based on what I've read, it seems that I would need the path for the file I right-clicked and probably pass that in as a parameter.
So I know two things: I know how to add something to the Windows Context Menu. I also know how to pass command-line parameters in the program. Currently all that is happening is the program starting normally when I right click on a file.
I hope I have expressed the problem clearly enough for anyone to understand.
Any help would be appreciated.
|
|
|
|
|
Does this[^] help ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
this one is in C#[^]
|
|
|
|
|
XD Oops.
The issue I had: Open and Save File Dialogs caused the program to exit.
Solution (in my case): Remove compatibility settings in Properties > Compatibilities.
modified on Monday, May 5, 2008 3:59 AM
|
|
|
|
|
Grass Cutting Sword,
Do you ever tell your program to exit/close for some reason? Do you use try{} catch{} for exceptions?
You'll need to provide more info, code etc, since we cant guess what it is from the above info.
Regards,
Gareth.
|
|
|
|