|
Hi !
I have an app created with C# with an MDI and a bunch of forms/reports.
Besides the MDI, I also have a form that can help users by showing what forms are there in the app. This form has BUTTONS only. and When any of them is pressed, that particular form will be opened and added to the MDI ... so on and so forth.
The problem is, when a FORM is closed, its memory is not released, because that other form with BUTTONS still has its reference. And I guess Garbage collection anticipates it might be used again.
How can I explicitly FREE MEMORY of a FORM OBJECT in a situation like this ?
I have tried from within the FORM_CLOSING, no luck.
Thanks much
c#
|
|
|
|
|
C#_Dude wrote: The problem is, when a FORM is closed, its memory is not released, because that other form with BUTTONS still has its reference.
Are you sure? Why would that form hold on to the references?
C#_Dude wrote: How can I explicitly FREE MEMORY of a FORM OBJECT in a situation like this ?
Normally you never free memory, you only make sure that the objects are properly closed and get rid of the reference to them, then the garbage collector will eventually collect them.
It's normal for objects to remain in memory a while after you have released them. The garbage collector makes a collection when it's convenient or when it's needed. There is no reason to collect objects when there is no immediate demand for memory.
---
b { font-weight: normal; }
|
|
|
|
|
The garbage collector frees an object when there are no references left. So, if your buton retains a reference to a form, then it will not be GC'd. The garbage collector does not anticipate anything. Once you've removed your last reference to an instance of an object, you cannot get that instance back again at all.
How does your button-form know "what forms are there in the app"?
Do you mean it shows what forms are open and displayed?
If so, then - the standard convention is to use entries on the Window menu for that- it's been standard windows UI behaviour since the 3.0 days at least.
|
|
|
|
|
Hi,
I have an xml file which contains the history of send sms messages.
I loaded the xml file into a datagridview. The problem is, i don't know how i can load the data back into their controls.
I got two controls where data can be typed in. The first one is phone number which is a textbox.
And a richtexteditor where the message can be typed in. But my xml file contains 3 nodes.
Node 1 = date and time in ticks.
Node 2 = phone number.
Node 3 = message.
So if a row in the datagridview gets clicked/selected, it should load the phone number in the textbox and the message in the richtextbox.
Thanks in advance!
|
|
|
|
|
Check out Databinding.
The idea is that you have a BindingSource object that acts as the intermediary between the DataSource (the datatable with the data) and the input forms.
check out the CP article here for more specifics: http://www.codeproject.com/vb/net/databindingconcepts.asp[^] Its in vb, not C#, but the concepts are the same, and the displays will really help explain it to you.
|
|
|
|
|
Hi,
I'm using serialize to export an object to XML and the object has a Font property.
All goes allright the font is stored with dot comma separator (when bold etc is enabled) in the XML file. so far so good when i restore the object on the same PC.
Here's the problem :
When restoring the object from XML on another PC with different regional settings the conversion fails because it expects a comma separator instead of dot comma.. (for the Font property)
When changing the list separator on the regional settings in windows XP, the problem disapears. But ofcours we cannot ask this to do at our customers.
So i gues i can change this regional settings in my software using the Cultureinfo.
But after changing the Textinfo.ListSeparator tot ";" or "," the problem remains and no changes are made when saving or restoring the XML file..
has anyone any idea how the solve this problem ?
Greetz and Thx
Kurt
|
|
|
|
|
Hi,
Seems i always have to post my own solution
OK,
Passing your own culture info to the fontconvertor seems to be a solution to my problem ....
"ConvertedFont" is a string containing the Font information.
FontConverter Tmp = new FontConverter();
ITypeDescriptorContext Dscrptr = null;
CultureInfo Cltr = new CultureInfo("nl-BE");
return (Font)Tmp.ConvertFromString(Dscrptr, Cltr, ConvertedFont);
greetz
Kurt
|
|
|
|
|
I have sample in which is running in VS2003 and the sample which I tried to run in VS2005 (V2.0.50727) gives me the below error.
Unable to start debugging. Iam getting the error message as given below.
1. The application you are trying to debug uses a version of the Microsoft .NET Framework that is not supposed by the debugger.
2. The debugger has made an incorrect assumption about the Microsoft .NET Framework version your application is going to use.
3. The Microsoft .NET Framework version specified by you for debugging is incorrect.
For solving this issue I did
In the Registry Editor, open the HKEY_LOCAL_MACHINE folder.
Navigate to: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\AD7Metrics\Engine\{449EC4CC-30D2-4032-9256-EE18EB41B62B}
then created new string "CLRVersionForDebugging" and value "V2.0.50727" . After doing all this things still Iam getting the same debug error.
Pls anybody can give solution for this problem.
|
|
|
|
|
Hi GnanaprakashJebaraj,
Usually, if you start a project which is programmed in an older version of IDE than the one in which you load it, it asks you if you want to convert it.
Did you got that message? If so, did you do that?
|
|
|
|
|
Yes, we got the message.After converting we try to debug the application It gives the debugger error.
For example download this sample and try to run
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrtdvbnet.asp
This application open's an Excel.In Excel formula bar paste the following formula
=RTD("Stock.Quote", , "MSFT", "Open")
=RTD("Stock.Quote", , "MSFT", "Last")
formula will return some random value in Excel.For this sample I was able to debug and run in VS2003 but in VS2005 Iam getting debugger error.
|
|
|
|
|
How to set a maximun value in NumericUpDown,while using a keyBoard
My small attempt...
|
|
|
|
|
Probably working on the numericUpDown_KeyDown event would help.
Try something like:
if (e.KeyCode > Keys.D5)<br />
{ <br />
e.SuppressKeyPress = true;<br />
}<br />
This will prevent the user from entering a digit greater than 5.
Hope that helps,
Ashish
|
|
|
|
|
Thanks for replying.Unfortunatly my problem is not fixed.I got a error like this
"'System.Windows.Forms.KeyEventArgs' does not contain a definition for 'SuppressKeyPress'".
Expecting a reply
My small attempt...
|
|
|
|
|
It seems like you're using an older version of the .NET Framework. System.Windows.Forms.KeyEventArgs.SuppressKeyPress is only supported in versions 2.0 and 3.0. Well, this isn't the end of the world..there's always an alternative. Try this in the KeyPress event:
private void numericUpDown1_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
if (e.KeyChar >= (char)Keys.D5)<br />
{<br />
e.Handled = true;<br />
}<br />
}
This should prevent the user from entering keys greater than 5 on the keyboard. This won't work if the user uses the numeric keypad. Just play with the ">= (char)Keys.D5)" part to get the desired results.
Hope that helps,
Ashish
-- modified at 4:22 Friday 10th November, 2006
|
|
|
|
|
I will check,thanks a lot.If i got the result i wil msg u.If u got the key try to infrom me.
My small attempt...
|
|
|
|
|
Do u feel,is there any other method.Actually i want to restrict the number greater than 10000.
My small attempt...
|
|
|
|
|
Hi All,
Am planning to take a test of 70-315(C#-Web application)by next week.Can anyone help me with details of latest pattern of the exam.
Thanks in Advance.
Thanks,
Mirunab
|
|
|
|
|
Mirunab wrote: Can anyone help me with details of latest pattern of the exam.
What does that mean?
I went along to the exam centre, signed in, was shown to a computer and they logged me into the exam. I then answered the questions and at the end of the exam I went back to the receiption where I received a print out of my grade.
|
|
|
|
|
ohh sorry.I think my question might be not clear.Here it is, wat's the thing is, am taking web application certification test. How many questions will be there.What are the major portion covered in that.What sort of questions will be there.At last can anyone help me with the latest dumps?
Thanks,
Mirunab
|
|
|
|
|
Mirunab wrote: How many questions will be there.
I don't remember, but I do remember that each question was given an average of 2 minutes to answer.
Mirunab wrote: What are the major portion covered in that
The questions are randomly chosen from a pool. You may not get the same questions as a person sitting next to you doing the exact same exam.
Mirunab wrote: What sort of questions will be there
Most are multiple choice - some are pick one, some are pick many. There is the odd question on putting things in the correct order.
Mirunab wrote: At last can anyone help me with the latest dumps?
No, that would be cheating.
The exam cram books are a good source of information and they have practice exams in the same style.
|
|
|
|
|
I don't know how to check my internet connection.
Did I'm connected on the internet or not.
I have Visual Studio 2003.
Vasildb
|
|
|
|
|
|
Hi Friends,
I created treeview with checkbox.
When user clicked on checkbox of any node of treeview how do I know that checked node is parent node or not?Please help?
There is no event that send treenode as sender. All Event send whole treeview as sender? please Help ?
Suhas Bothe
-- modified at 7:57 Thursday 9th November, 2006
Suhas Bothe
|
|
|
|
|
Hi,
the node that has been checked is supplied in the TreeViewEventArgs of the event. Use its ParentNode property to determine whether it has a parent or is a top level node.
Robert
|
|
|
|
|
There are no any Propety for System.EventArgs e.
please can you explain in details?
|
|
|
|