|
Thanks I m getting the result of your code. But it is not providing me the actual result that I needed.
|
|
|
|
|
I have a windows service multithreaded application for indexing purpose which have six threads. It is working fine except memory leakage. Actually when the service is started, then the service is consuming 12,584kb memory, after some time it is taking memory of 61,584 kb. But after indexing process is complete it is not releasing memory. I need it come back to its previous position after the indexing is complete, that is it should take the memory with which it started e.g. 12,584kb in this case. I have used garbage collection but it is not doing what I want.
Can anyone please help me?
|
|
|
|
|
Are you sure it's actually using that memory. Task Manager reports the amount of memory a process has reserved, not how much it's using. If that memory is needed elsewhere and your app isn't using it, it will be reclaimed.
In case it is, make sure that any objects you are using that have a Dispose method have that called once you are done with them [Edit] or better still, if possible use using blocks [/Edit]. If you are using any PInvoke, make sure you are releasing any unmanaged resources too.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Task Manager is telling you how much memory is reserved for the .NET CLR your app is running under. It's entirely possible for the CLR to reserve that much memory even though your app is not using it. The reason for this is because the CLR watches what your app has done and since it already allocated a large amount of memory, it'll keep the memory around in case your app wants it again. It's fast to allocate an object with memory that is already in the Managed Heap than it is to wait for the CLR to request memory from Windows, add it to the Managed Heap, then make the allocation.
|
|
|
|
|
Hello,
i am using a webbrowser control on my form together with textboxes. What i need is that when i load the form the cursor will be in textbox, but instead the webbrowser "steals focus". I have tried using the Focus() property for the textbox in just about anywhere now but it still wont work. Also i have tried creating event handlers for webbrowser's different events (GotFocus, Validated etc) but nothing seems to work.
The only thing that worked was the DocumentCompleted handler, which can make the cursor go to the textbox but not when the form loads, which is strange, since i have the browser go to a web page when the form loads (after InitializeComponent).
TY
|
|
|
|
|
What you need to do is set the Tab Order. This indicates which controls get the input focus in which order when you press tab to switch between them. The lowest tab order control gets the focus first on form load. Simple.
Tab order is initialy assigned in order of control creation, so if you create your browser first, then create the textboxes, the browser gets the focus.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I forgot to mention it, but tab order has been set properly. The cursor still goes to google.com's search bar (google.com is the site being automatically loaded into webbrowser at startup).
|
|
|
|
|
Just tried it, with a browser docked in a panel, and a textbox with button outside the panel. Set URL to "http:\\www.Google.co.uk" in design properties, TabIndex is Textbox = 0, button = 1, panel = 2.0
Works fine, Cursor in textbox on form load. How is this different from yours?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Its not different. When i do the same thing, the cursor automatically goes to webbrowser
I just discovered that the problem exists only with some pages (google, orkut, youtube, hotmail etc). When i use any of my local sites (.ee) then it works just fine.
Why is that so? google and microsoft using some fancy scripts?
modified on Wednesday, September 2, 2009 2:54 AM
|
|
|
|
|
How can I prevent the ^ character from being typed in a textbox? The problem seems to be that the character is not added before another keydown/keyup event.
For some other keys I used the following code to prevent them from being typed:
void textBox_KeyUp(object sender, KeyEventArgs e)
{
if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
{
if (e.PlatformKeyCode <= 12)
e.Handled = true;
switch (e.PlatformKeyCode)
{
case 226:
e.Handled = true;
break;
}
}
else if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
switch (e.PlatformKeyCode)
{
case 52:
e.Handled = true;
break;
case 186:
e.Handled = true;
break;
}
}
}
However, this does not work for the ^ character.
Thanks for help!
|
|
|
|
|
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == '^')
{
e.Handled = true;
}
}
|
|
|
|
|
Couple of things:
1) KeyUp is probably not a good place to disable keys, as KeyPress happens repeatedly before KeyUp occurs. Try handling KeyDown, KeyPress and KeyUp with Console.WriteLine in each to show the flow of events.
2) If you are going to use magic numbers then comment the damn things so the next poor sod stands a chance of understanding what you are doing:
case 52: is a lot more useful than
case 52: By preference, use '%' instead of magic numbers, or constants with sensible names, or even "Keys."
3) Use KeyPress to disable your code:
private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '^')
{
e.Handled = true;
}
}
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks for the replies guys. Sorry, but I forgot to mention that I work in Silverlight. I can't get to the KeyPress event. Only KeyDown and KeyUp.
Thanks again.
|
|
|
|
|
In that case you should probably post your question in the SilverLight Forum.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I need to have a popup window asking user for yes and no when he selects delete if he says yes i go ahead and delete otherwise i return back to screen and do other things.
Can I write a javascript method and call it in onclick of my delete button?
will it work?
not sure as delete linkbutton runat="server".
|
|
|
|
|
wrong forum -> goto ASP.NET
|
|
|
|
|
Hi everyone.
I'm having an error in my application that is confusing me.
The error is this one:
Could not find a part of the path "C:\CrkBusinessplatform\Aplicacao\Publico\sistemas\ccs\CRK.Monitores\sistemas\ccs\CRK.Monitores\monitor_arquivos\xslt\ACCS001.xslt"
Here are the facts: The correct path would be C:\CrkBusinessplatform\Aplicacao\Publico\sistemas\ccs\CRK.Monitores\xslt\ACCS001.xslt -> A part of the path is coming twice.
The archive ACCS001 is in this correct path.
The code line of the error is like this:
xslt.Load(Page.Request.PhysicalApplicationPath+"/monitor_arquivos/xslt/ACCS001.xslt");
I'm using .NET 1.1 on IIS 6.
The folder CRK.Monitores is a virtual directory in IIS. So the code should return the right path, right?
Oh, one more thing. The DLL of this page is the same here and there(I have checked it). And the error does not occur here.
Thanks in advance.
|
|
|
|
|
wrong forum -> goto ASP.NET
|
|
|
|
|
you seem to be mixing slashes and backslashes, Windows doesn't like that very much. Try using backslashes consistently.
|
|
|
|
|
Have you tried echoing Page.Request.PhysicalApplicationPath to confirm that what you think it outputs is what it actually outputs? To me, this looks like you're making a false assumption about the returned value.
|
|
|
|
|
How to add Sort Icon to Gridview Header in Windows Forms(Win Application)?
|
|
|
|
|
HI...
want a Auto hide control component. The control like Visual studio 2008 IDE Solution Explore or Tool view.. If mouse over or click Tool view , tool view item are expanded... i want like control... how can create this control or if its in build control , name of that control and how use that control
Thanks....
|
|
|
|
|
|
Thank you for that Source Code....
|
|
|
|
|
Hi All,
I have created a custom video player in C#. This player has two forms.
1. The Video Player window ( running in primary (UI) thread )
2. The content playing window (running in a secondary thread)
Everything goes fine for nearly 5-6 hours, then the main video player window freeze.So i cannot access any of the buttons (stop, pause ,exit) in the player.
But the secondary thread keeps playing the files for even two days continuously ( which is the max i tested).
Things i have checked :
1. There is no memory issue, since i dispose the objects i create after playing each file ( few min videos) . I have checked the process in task manager, where status is running and memory usage as same as it is started.
2.I have used BeginInvoke from secondary thread to update the current playing file in the list box on the main video player window ( once the main window freeze, the update is not visible)
3. I have used a timer in the main video player window and tried refreshing form , calling Application
.DoEvent() for every few minutes , still it gets freeze up after 5-6 hours.
Why the UI window freeze up?
Is my architecture for the player is wrong?
(I need to do lots of processing in secondary thread for the images and videos to be played, but it is working fine)
Kindly give me your suggestions.
|
|
|
|