|
hi,
Can I find any component that do this task "Pass Table Name Build Your Form " and give admin ability to change the type of control and hide any control as he want ?
|
|
|
|
|
hi all,
i have a array object in one of my method, i would like to know, should i dispose it when end the coding or not? It will automate throw into garbage colletor? Below is what i am done in my application,
private void DrawConnectedLine(Graphics g)
{
try
{
int[,] drawobjectlist = new int[totaltransporter,n];
:
:
:
drawobjectlist = null;
}
catch(Exception exp)
{
}
}
thanks in advance,
regards
cocoonwls
|
|
|
|
|
When you set an object to null, you're not actually disposing it, your just removing it's memory reference. While it's not a bad practice to set it's value to null once you're done with it, Visual Studio automatically removes the pointer for you when the method ends. It's good to see a developer that's concerned about memory management!
Cheers!
Richard
My code this week has no errors. But it's Monday morning and I haven't got out of bed.
|
|
|
|
|
Since your array contains integer, no need to dispose it. If you are using any types which has Dispose method, calling it after using is a good practice. Read[^] Scott's article on this subject.
|
|
|
|
|
cocoonwls wrote: should i dispose it when end the coding or not? It will automate throw into garbage colletor?
Disposal and garbage collection are two different things. Disposing an object doesn't cause it to be garbage collected.
You can't call the Dispose method on an array, as it doesn't have one. An array only uses managed resources, so there is no need for any disposal.
cocoonwls wrote: drawobjectlist = null;
Setting the reference to null serves no pupose at all in this case. The garbage collector already knows that the array is not used any more, and it can even have collected it before you remove the reference. You are just assigning a null reference to a variable that is not used any longer.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Just to reiterate what has already been said, an array itself doesn't support disposal but the objects contained in the array may, in which case you want to iterate over the items and call Dispose on each item. In this particular case, you have an array of int , which doesn't require disposal.
Setting the array to null in this scenario will have no effect. The JIT compiler (and by extension the GC) is smart enough to know when the object is no longer in use.
The thing to keep in mind is that the GC will only collect this array after it is no longer in use and when enough memory pressure exists to trigger a collection cycle. It won't necessarily be collected when the method goes out of scope.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Dear all,
Thanks your guys. Now i have clearly concept on disposal and GC.
|
|
|
|
|
Does anyone know how to do this? I looked on google, and I can only see how to do it with the command line compiler. Any help is appreciated, thanks,
-Kenmaz
|
|
|
|
|
Right click on the project in the solution explorer tab. Click "Properties". Go to the "Build" tab. Click "Advanced". (Vs2005/20008 only I believe)
The "Debug Info" option controls whether symbols are generated or not. This option is dependant on the active configuration. You will need to set it independently for each configuration you have set up (Debug, Release etc)
Simon
|
|
|
|
|
Does anyone know of some good code to develop a database search engine? For instance, let's say I wanted to search all possible tables in a database for the occurences of the phrase: "customer fred jones 1/03/02". Splitting the search query into separate items is no problem, it's just knowing how to dynamically search the database.
Any help would be greatly appreciated!
Richard Blythe
I've used up all my sick days, so today I'm calling in dead.
|
|
|
|
|
Sounds like you need to investigate the system tables. Getting a list of tables and their columsn from sql server is easy enough - check out the information_schema views. Fromthis you should be able to generate your search.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I have error : Access to the path'c:\abc.text' is denied
I run my applications so many times before this error occur
What's the problem?
Thanks
|
|
|
|
|
By the defenition of "..run my applications..", do you mean that you start the program, open/read file, then close the program? If your not actually closing this program, it sounds like your not disposing the file handle properly.
I've used up all my sick days, so today I'm calling in dead.
|
|
|
|
|
Whatt you are trying to do,Reading or updating the file?
Cheers!!
Brij
|
|
|
|
|
Hi,
I am developing a C# application which launches a couple of other applications (non-C#). I can use the System.Diagnostics.Process class to start the child applications, but how can I embed these child applications into my Window forms and dock them at fixed positions in my MMI so that the whole thing looks like a single application? I dunno whether what I am asking makes sense, it's something like XWindows or Remote Desktop, where the remote application runs inside my own C# Form... Any suggestions? Thanks in advance.
|
|
|
|
|
You can make a hosted application window show up in a Panel or other container control in your form but you cannot make it look like it is an integral part of your application. You have no control over how the hsoted app's window is rendered. Docking is pretty much just moving the hosted window so it's up against the side of yours, but you can't stop the user from just grabbing the title bar and moving it.
You will need to look into the Process class' MainWindowHandle property and the Win32 function SetParent[^].
Keep in mind, that any child windows that the hosted app shows could very well show up outside your application window. Also, some applications do not like having their main window hosted by another parent, but most will. You could run into rendering problems or other strange issues.
|
|
|
|
|
|
For my application, I really need a timeline editor (a keyframe-like editor like can be found in Flash and Director and movie and sound editing software).
I'm guessing something like this has already been implemented somewhere. Does anybody know of anything that could be harvested? If not, does anyone know of a tutorial that suggests how to create one?
Thanks!
|
|
|
|
|
hi evryone
i have some quetion about xml file's
1. how i create xml file in c# code ?
2. how i can delete some records in xml file ?
3. how i can search record in xml file ? (like sql query)
i whant to work on xml file like Databse
my project is in c#
than'k alot for any help
|
|
|
|
|
Take a look at System.Xml.XmlDocument
|
|
|
|
|
i asked the same question before.
try LINQ to query XML! but not as good like using a real database
download here samples about that subject(xml), not the hardest thing to learn, i think!
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
E_Gold wrote: how i create xml file in c# code ?
Using XMLDocument or XMLTextWriter .
E_Gold wrote: how i can delete some records in xml file ?
Load it to XMLDocument instance and work with RemoveChild[^] method.
E_Gold wrote: how i can search record in xml file ? (like sql query)
Either use XPath or Linq-XML .
|
|
|
|
|
Hi All,
In my current C# app I need to write what seems to be a non-standard format XML file to be loaded into a very picky application.
I'm limited to this kind of format:
<rootnode name="preset #1" attribute1="" attribute2="">
<childnode index="0" />
</rootnode>
If there are any namespace (like xmlns the app won't load the file, if there is an encoding="" the app wont load the file also.
And to top it off the file needs to use UNIX ANSI not Windows ...
Does anyone have any ideas or info/links on how to achieve this?
Thanks,
|
|
|
|
|
Maybe if I could see it?
|
|
|
|
|
On the other hand, there appears to be very little data, so I bet it loads real fast.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|