|
right, i had some timer's and upon closing i stoped them, but i was wonderig if thre is a way with one command stop them all, this is why i was going in this direction.
Thanks for your help
|
|
|
|
|
Write the timer stop code in Form's dispose method. Also consider using background threads to do the processing. Background threads will terminate when the parent thread terminates.
|
|
|
|
|
great idea
thanks
|
|
|
|
|
I can add text, data values from the database into a word file through the C# coding. I want to know how to insert an image in the word file through c# coding?Plz help urgently!!!!
csetopper_bhanu
|
|
|
|
|
Hi,
Please let me know the difference b/w abstract and Interface...with example...
im confused......
|
|
|
|
|
|
Hello all ,
I have couple of questions .
1.why do we need to call forcibly Garbage Collector when we dont know which object is going to be destroyed ? I mean i would like to know the scenarios where exactly we need this .
2. i have requirement that i need a custom class in which i can destroy the class when needed. is it possible ? if yes can u lease give me code to do it .
3. How can i say this resource is Unmanaged and this one is managed ?
Apologises incase of trouble.
Regards,
Jaddu
|
|
|
|
|
1) One scenerio would be an application that creates several temporary objects that need to be cleaned up occasionally during the apps lifetime to prevent memory leaks and performance degradation. A graphics editor could be an example.
2) Use the Dispose pattern[^]
3) Start here[^]
only two letters away from being an asset
|
|
|
|
|
1 - Mostly you don't need to use this method. I have only used it to test the language/framework features. Here[^] is a decent blog post on the subject.
2 - You can't reclaim the memory allocated deterministically. It is handled by GC. If you have critical resources that needs deterministic cleanup, use Dispose[^] pattern.
3 - AFAIK, there is no good way. Usually framework classes implements IDisposable to say it has got something to cleanup. In C#, you can't use unmanaged classes directly. You use it using P/Invoke. So if you are seeing P/Invoke calls, there will be unmanaged code involves.
|
|
|
|
|
Hi all,
i am just monitoring the URL changes, using SHDocVw.InternetExplorer
is it possible to hide the context menu
i have used the following event like bellow:
((mshtml.HTMLDocumentEvents_Event)document).oncontextmenu += new HTMLDocumentEvents_oncontextmenuEventHandler(clsURLMON_oncontextmenu);
bool clsURLMON_oncontextmenu()
{
return false;
}
it disbles but does not allow any links to proced and entry as well
can some help me......
thanks a lot.
|
|
|
|
|
Hi all...
I'm representing an XML file through TreeView.
I load the XML file as an XMLDocument and then transform the XMLNodes into TreeNodes to build the tree... so I have a tree of XMLNodes (the XMLDocument ) and a tree of TreeNodes which have the same formation.
My question is: if I'm selecting a TreeNode how can I reach/address it's XMLNode at the XMLDocument , do they share a common path??
|
|
|
|
|
reilak wrote: do they share a common path??
Yes,
first change change properly the value of PathSeparator property of the TreeView to / and next use XPath expressions to access your document calling XmlDocument.SelectSingleNode with TreeView.SelectedNode.FullPath property.
|
|
|
|
|
Ok, I retrieve the full path of the treeNode and use the string.replace() method to change the PathSeparator from '\' to '/', the thing is that I have a problem with this representation "\" of the \ character, it's like I didn't close the string, why?
EDIT:
string TNpath = treeView1.SelectedNode.FullPath;
TNpath.Replace("\", "/");
|
|
|
|
|
Hi, character '\' is special character it need's to be escaped
use TNpath=TNpath.Replace("\\", "/"); instead of TNpath.Replace("\", "/");
|
|
|
|
|
It gets the full path, including the file path, and it cause an XPath error. ):
|
|
|
|
|
You would better start learning XPath from here.
|
|
|
|
|
hi!
i have a very weird problem:
i have an app which listens for connections, and once a client connects it starts anothter app,
now if the main listening app terminates but app2 is still running then the port isnt released and when the main app starts up again and try to bind to the port it fails (port already in use).
the port is first released when app2 or all of its child processes has terminated, but these processes has nothing to with the main app, so why isnt port released after the main app has been terminated?
|
|
|
|
|
After little more investigation with process hacker (Process Hacker/[^]) i see that the apps started from the main listening app and there child process gets the handle to the named pipes and somthing called \device\afd that main app has created, if i close those handles then the port is released, if i dont then the main app actuallty keeps running and listening on that port according to process hacker but doenst respond to incoming connections.
so the main app, after its terminated doenst show upp in process list/taskmanager or netstat tool but shows up as UnknownpProcess in process hackers "network connections" listening on the port??
How can i fix this?
This is how the app currently works...
My App --> starts app2 and creates pipes. Now if my app gets terminated then app 2 is also terminated, but i have no control of which apps app2 might start and they are not terminated once app2 gets terminated so they keeps the handle to named pipes and (mainly)device\afd and keeps the port busy?
|
|
|
|
|
the problem was that all processes was inherting sockets handle
Anyhow i thought i might post the solution if any1 else have same problem, simply use SetHandleInformation [^]thru pinvoke!
|
|
|
|
|
am working on a micro-finance accounting system, and i have decided to use MySQL as the database. I have installed MySql 4.01, and have everything including the Server, Admin, and connector installed and running fine.
Am currently trying to test a means of loading data into a datagridview from one of the tables in the MySql db. But app fails when i try to open a connection to the db:
MySqlConnection con = new MySqlConnection("server=localhost;database=pets;uid=root;password=alchemy@6");
con.Open(); //creates error "Access denied for user 'root'@'localhost' (using password: YES)"
can someone help me?
|
|
|
|
|
looks like your username and/or password is wrong do you not think?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I don't think, because i have just used those very parameters to log into the database via the MySql Adminstrator (GUI), and can clearly see the database.
could it be a result of having a session running with those very details in the Adminstrator?
|
|
|
|
|
I am not so familiar with MySQL but if there is a setting that specifies the number of logins available (like in SQL Server) then I would say that could be a cause yes. One thing to note about database connection is that the error message you get is not always correct
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Well, after rummaging through the MySQL .NET API Documentation and failing to find a clue, i decided to change the connection string to a different one like this:
my Original : "server=localhost;database=db;uid=root;password=abcdaaa"
in the API : "Database=db;DataSource=localhost;UserId=root;Password=abcdaaa;";
New Hack: "Database=db;DataSource=localhost;UserId=root;Password=abcdaaa;Port=3308";
/*This worked bcoz i realised i had configured MySql to listen on port 3308, tried changing it back to 3306 (default) with no success, until i decided to add the 'Port=3308' to the MySQL connection string.*/
|
|
|
|
|
The problem is:
By using late binding call the TransferSpreadSheet metod with arguments (acExport, default, "querryname", "querryname.xls",default,default)
The question is:
How can i get acExport constant of AcDataTransferType an how should i transfer it to TransferSpreadSheet call method?
Parameters = new Object[5];
Parameters[0] = ???!
Parameters[1] = Type.Missing;
Parameters[2] = "querryname";
Parameters[3] = AppPath + "\\querryname.xls";
objDoCmd_Late.GetType().InvokeMember("TransferSpreadsheet", BindingFlags.InvokeMethod,
null, objDoCmd_Late,Parameters);
Advice needed.
modified on Tuesday, August 4, 2009 8:43 AM
|
|
|
|