|
I begin learn C# i create 2 class connect.cs and Dataacess.cs
in Dataacess class I want to using connect class like VB.net Imports a class but error
using Connect;
i don't understand
Tell me about please
Thanks
quan
|
|
|
|
|
using is for namespaces. If your classes have the same namespaes, you don't need it. In fact, imports works the same way.
Connect c = new Connect();
will create an instance of the connect class for you.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi,
I have create a custom user control.How can i create the control dynamicly and put into a array.
any hits are welcome,
thanks in advance
cocoonwls
|
|
|
|
|
List<myUserControl> ctrls = new List<myUserControl>();<br />
<br />
myUserControl ctrl = new myUserControl();<br />
ctrls.Add(ctrl);<br />
<br />
life is study!!!
|
|
|
|
|
Please see the fillowing link. I think this will help you.
http://www.codeproject.com/useritems/DynamicServerControls.asp
asd
|
|
|
|
|
Dear All,
I assign memory to a parameter to store some information. I start with the value null for that parametr. After usage, I set the value back to null, but the memory assign to the parameter is not released. How do I destroy the parameter ? Any help is , as usual , highly appreciated.
private FormNetworking _fo;
public void pbNetworking_Click(object sender, System.EventArgs e)
{
if (_fo == null)
{
_fo = new FormNetworking();
_fo.Show();
_fo.FormClosed += new FormClosedEventHandler(fo_Closed);
}
else
{
_fo.Focus();
}
}
public void fo_Closed(object sender, FormClosedEventArgs e)
{
_fo = null;
}
kind regards,
|
|
|
|
|
If your object has a DIspose method, call it first. Otherwise, you have to wait for the GC to do it's thing.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thank you so much for your input.
Unfortunately it didn't do the trick. I invoke :
_fo.dispose();
before closing the form but the memory is not released. Every time I open a new instance of the form, it adds a little bit ( about 8 k ) to the memory.
|
|
|
|
|
Welcome to a GC system. Memory is released sometime in the future, there's nothing you can do, and nothing to worry about. Still call Dispose, tho.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I guess you're right. Even unmanaged resources eventually have to rely on the GC to get cleaned up.
thx for your anwser , I won't worry then
|
|
|
|
|
As Christian pointed out, welcome to a garbage collected world. At some point after your object is disposed, the GC will eventually free the memory. Calling Dispose only helps mark the object as collectible.
Rick van Woudenberg wrote: Even unmanaged resources eventually have to rely on the GC to get cleaned up
Unfortunately, the GC does not know how to free unmanaged resources. That is the reason to call Dispose when you are done using the object.
For a more detailed look at how to implement Dispose , check out the following article:
http://www.codeproject.com/useritems/idisposable.asp[^]
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Scott Dorman wrote: Calling Dispose only helps mark the object as collectible.
That's incorrect. Calling Dispose has nothing to do with garbage collection, it is required only to release the resources held by the object immediately. The GC only checks for references to an object to find out if it's eligible for collection.
|
|
|
|
|
You are correct...that statement was inaccurate. However, when the GC does collect an object it will call the Dispose method if it hasn't already been disposed.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Scott Dorman wrote: However, when the GC does collect an object it will call the Dispose method
I guess you meant Finalize instead of Dispose.
|
|
|
|
|
Arrrrrgggggg!!!
Yes, I did. It's been a long day...and it's only half over. I guess that's what happens when you don't get more than a few hours of sleep the night before.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Yeah, one thing a lot of people miss is the Dispose/Finalise pattern.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hello,
To make sure if your class is really ready for the GC, call GC.Collect() just for testing (Of course its not recomended to leave it in your code).
It could also be possible that the FormNetworking instance holds a connection too an other custom class (for example over an eventhandler), and so the GC will not clear the memory!
I also would recomend too check youre code with .Net MemoryProfiler (freeware).
All the best,
Martin
|
|
|
|
|
Can any Body tell me what is Bug Tacking System.
|
|
|
|
|
It's a system, right, for tracking ( are you still with me ? ), bugs.
In other words, it's something you could easily have googled for, or gone to wikipedia, it's a system that is used to keep track of known issues in your software, and when/how you fix them
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thankx for replying Christian Graus.
|
|
|
|
|
Hi boys & girls,
I would like to implement automatic updates to my application (which is in C#).
I’m quite confused, I heard that there is ClickOnce\ Updater Application Block built in .Net 2005, is it correct?
How do I use it?
Were can I find relevant tutorials?
In the MSDN site I could find only the Updater Application Block for .Net 2003
Thanks,
Gil
May the source be with you
|
|
|
|
|
I have been working on trying to write a directory watcher service.
One of the requirments is that it be able to watch multiple
directories, not sub directories of one parent directory, but just
multiple directories.
Using FileSystemWatcher in .Net
Thanks in Advance
Hari
|
|
|
|
|
well, I don't see the problem..
just use some a number of FileSystemWatcher objects..
life is study!!!
|
|
|
|
|
Hi You can do it creating Multiple FileSystemWatcher Objects.
Here is a code snippet of it.
//Folder to be monitered are placed in Appconfig seperated with ;
char[] delimiterChars = { ';' };
string FoldersNames = ConfigurationSettings.AppSettings["FoldersToMonitor"];
string[] fileNames = FoldersNames.Split(delimiterChars, System.StringSplitOptions.None);
foreach (string s in fileNames)
{
FileSystemWatcher Clientwatcher = new FileSystemWatcher();
Clientwatcher.Path = s;
Clientwatcher.Filter = "*";
Clientwatcher.NotifyFilter = NotifyFilters.LastAccess;
// Clientwatcher.Created += new FileSystemEventHandler(OnChanged);
Clientwatcher.Changed += new FileSystemEventHandler(OnChanged);
// Clientwatcher.Renamed += new RenamedEventHandler(OnRenamed);
Clientwatcher.EnableRaisingEvents = true;
fw.Add(Clientwatcher);
}
Enjoy.
Satya
|
|
|
|
|
Sorry forgot the declaration of fw. It's an arraylist.
ArrayList fw = new ArrayList();
Satya
|
|
|
|