|
Thats right, i removed Abort everything working fine. Just for knowledge, trying to debug what bad happening when Abort is used. And want to make sure that the thread i was Aborting (now not) is not hanging out somewhere in app domain consuming any memory.
|
|
|
|
|
Member 2324483 wrote: Just for knowledge, trying to debug what bad happening when Abort is used.
Using Abort will throw the exception at different places each time - this is the problem with it. So I don't think you will learn anything useful from debugging it!
Member 2324483 wrote: And want to make sure that the thread i was Aborting (now not) is not hanging out somewhere in app domain consuming any memory.
You can use the debugger for this. Give your threads a name, break the debugger after they should have terminated, and then look at the "Threads" window in VS to see if they are actually gone.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Thanks everyone, who made me understand the problem.
|
|
|
|
|
You're welcome
----------------------------------
Be excellent to each other
|
|
|
|
|
Nick Butler wrote: Abort exists for the CLR to use when tearing down a process. It should never be called by user code.
AFAIK, calling abort from the same thread is safe. It won't throw ThreadAbortException .
|
|
|
|
|
Calling Abort on your own thread is the only ( barely ) acceptable use. It does throw a ThreadAbortException, but you know exactly what your thread is doing when it is thrown: it's in Thread.Abort!
This should still be avoided, though. There are better ways to terminate a thread.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Nick, few brief better ways to terminate a thread?
|
|
|
|
|
Member 2324483 wrote: few brief better ways to terminate a thread?
Better way is what Guffa said. Let the thread check a boolean value and if it is set as false, exit from the thread method. Something like
volatile bool canContinue = true;
void ThreadMethod(){
while(canContinue){
}
}
void StopThread(){
canContinue = false;
}
|
|
|
|
|
Hi,
Please advice me how to implement Active Document Container applications in C#. Is that possible to interact with Active Document Application developed in VC++ 6.0 or a brand new concept or technology available with C# ?
Please advice ...
|
|
|
|
|
Does anybody knows how can i beautifully copy data from doc1 to doc2.
IHTMLDocument2 doc1 = null;
IHTMLDocument2 doc2 = null;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
doc1 = webBrowser1.Document.DomDocument as mshtml.IHTMLDocument2;
doc2=doc1;--->this create reference. I don't want like that
}
Thanks for your help
|
|
|
|
|
|
Antonio David Gonzalez wrote: This article explains several ways to clone objects in C#:
netJP12L wrote: IHTMLDocument2
Antonio, IHTMLDocument2 is a COM Interface, not a managed object.
led mike
|
|
|
|
|
So what do you guys think how should i copy the data. The problem is that I want to see if doc1 objects has been changed or not by comparing the initial state of the doc1 and storing in doc2.
i.e
if(doc1.body.innerhtml!=doc2.body.innerhtml)
{
MessageBoxshow("doc1 object has been changed");
}
|
|
|
|
|
netJP12L wrote: I want to see if doc1 objects has been changed or not by comparing the initial state of the doc1 and storing in doc2.
i.e
if(doc1.body.innerhtml!=doc2.body.innerhtml)
By comparing the html string? Why do you need a second COM object to compare strings?
led mike
|
|
|
|
|
Thanks for replying but it doesn't work by comparing the two strings may be iam doing something very silly, that's why i am trying to create two object. The 2nd object holds the 1st object inital state data.
|
|
|
|
|
netJP12L wrote: but it doesn't work by comparing the two strings
I don't understand. You posted the code showing that you wanted to compare the two strings
netJP12L wrote: if(doc1.body.innerhtml!=doc2.body.innerhtml)
All I am saying is that you don't need another COM object to compare strings. If you don't know what your requirements are I certainly don't. If you ever figure out what the requirements are maybe you could post them and someone could help you.
led mike
|
|
|
|
|
|
Antonio David Gonzalez wrote: Anybody knows a better way to do this?
Do what?
led mike
|
|
|
|
|
If you are not using a sql database do it will help of xml.
You add new row with data from where?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I am trying to put together a quick and dirty app, but have hit a problem and need a litle help!!
basically i have a DataAdpter and fill a datatable. This is then bound to a grid, and the user can edit the data (not add or delete records tho)
Easy so far!
Then they can click save and i call
_adapter.Update(_dataTable);
now if some of the data has been changed in the database i get an DBConcurrencyException. What i really want to do is prompt the user for each record that has changed by another app in the database, and ask if they want to force their values on the record or abort that record update, and continue with the rest. Can i do this, still using the _adapter.Update method? if not, whats the easyest (sp) way to do it
Many Thanks
Mark
|
|
|
|
|
after some digging, i have found the answer
adapter.ContinueUpdateOnError = true; will make sure it continues after an error
and
SqlCeCommandBuilder builder = new SqlCeCommandBuilder(adapter);
builder.ConflictOption = ConflictOption.OverwriteChanges;
Makes it a last in wins, which will do for my app.
|
|
|
|
|
Hi all.
I have a problem and i can't seem to solve it.
I have a DataTable with all the Data a need. From time to time i need to make a call to the DataBase to refresh the DataTable. I need to add/update/remove the rows from the DataTable comparing them to the rows that came from the DataBase.
How can i do that? I can add the new rows, but if some rows where deleted/updated in the DataBase how can i delete/update them from my DataTable?
|
|
|
|
|
How about just clearing the DataTable and re-grabbing the data from the database. since you're bring all the data down anyway, it would probably save some CPU time as well.
Hogan
|
|
|
|
|
Thats right. But theres only one problem. If the user has scroll down the Grid and i clear the DataTable and refill-it then scroll will go to the first item in the list. Is there a way of avoinding that?
Thanks for your reply.
|
|
|
|
|
My file contains records which look like this:
EMPLOYEE001,M,20081105
First column is employee ID, second is gender and third is date.
I want to read this from a comma separated variable text file and think a regular expression is the way to do it. I do not want to create a dataset from the file.
Help much appreciated
|
|
|
|