|
A thread terminates when it has no more code to execute (it gets to the end of the method you set as it's start method).
You REALLY need to understand how threads interact or you will just spend your entire time debugging things you do not know anything about. Read some tutorials, for example this one:
MSDN[^]
Generally speaking you communicate with one of the following methods:
1) Communicate with Events (ManualResetEvent, AutoResetEvent). This is typically used to signal things like "data inserted in queue", "terminate" etc. The advantage is that a thread can wait for an event to be raised without consuming CPU resources.
2) Shared data protected by locks. For example a queue one thread is inserting in while another thread reads, or the tread setting a value on a "result object" passed to it. Simple datatypes (int, bool etc) can be marked by the keyword "volatile" instead of using a lock for each access.
3) Invoking from your subtread to the main thread (look at the Dispatcher object, or the old WinForm.Invoke stuff). This allows updating for example a WinForm userinterface where only the GUI thread is allowed to change control values, but is also a pretty sollid way to ensure data is only manipulated on one thread which means you do not need to do locks (as long as you make sure the worker thread is always working on a copy of the data).
Instead of setting a terminate event you can allso raise a ThreadInterupt exception, but please notice a thread will NOT interrupt while executing your code - it will ONLY interrupt from a safe state, like waiting for an event... and in that case you can as well have it wait for a terminate event as well.
|
|
|
|
|
Thanks You
i'm working with basic Threads, like
Thread obj = new Thread(method);
but now i need to expand my brain =)
reading msdn =)
|
|
|
|
|
C# has XmlDocument and other xml operate object.
has it Html operate object? such as XmlDocument.
use in WinForm.
|
|
|
|
|
check SHDocVw.dll (Microsoft Internet Controls)
You can use Document property WebBrowserClass to get the HTMLDocument.
Hope this helps you.
|
|
|
|
|
where is SHDocVw.dll in?
I want to use it in ClassLibrary.
|
|
|
|
|
Basically SHDocVw is a com dll.
Add following references...
.NET -> Microsoft.MSHtml
COM -> Microsoft Internet Controls
Then You can use MSHTml.HTMLDocument object to access various properties of HTML like activeelement, baseurl, childnodes etc...
|
|
|
|
|
I have a html Fragment:
"{font face=宋体 color=#FF00FF>JasonJason
|
|
|
|
|
Can you just try out using mshtml.HTMLDocument class?
I remember using it for somewhat similar purpose.
Or else if possible mail me your file I will look if I can do any thing.
Thanks...
|
|
|
|
|
HTML is a page description language, not a programming language, so it doesn't have any objects at all.
Javascript has some objects to handle XML.
google "javascript xml"[^]
---
single minded; short sighted; long gone;
|
|
|
|
|
I want to get some html's Element's text value, and some Attribute value.
Html structure as follows:
Textjason
Textjaosn
....
img and text irregularly display.
I want font-Attribute,text and src's value.
how to do is better?
|
|
|
|
|
I can only see half of the code that you posted. Use the "Ignore HTML" option when you are posting htlm code.
---
single minded; short sighted; long gone;
|
|
|
|
|
<font size=2 face=宋体 color=#FF00FF>
jason
<img src='file:///E:\\Projects\\FreeIM\\FreeIM\\bin\\Debug\\face\\2\\0.gif'>
jaosn
<img src='file:///E:\\Projects\\FreeIM\\FreeIM\\bin\\Debug\\face\\2\\1.gif'>
....
</font>
|
|
|
|
|
That is not valid XML code.
It looks like HTML code. Where do you get it from and how are you trying to use it?
---
single minded; short sighted; long gone;
|
|
|
|
|
I have some UserControl with 4 button.
This userControl is set on some Form.
I call the method ShowWindow to pop up the Form.
In my form i have 6 button that one of them is the default button - but in each time i call the ShowWindow i see that the default button is different from the button that i define.
If i go to other userControl and then back to the first userControl - i getting the right default button.
Why i can't set the default button to be as i want ?
Its happened only on specific UserControl - other UserControl that i wrote work fine.
I really need help.
Thanks.
|
|
|
|
|
Have you tried to use Focus method on form visible changed event?
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
I try to use Focus method on the Visible change event, and also on the Constructor, and also in alot of other places.
|
|
|
|
|
I have temprory table. i have using grid view.
all rows in show in grid view.
when temprory table convert to datatable.
I want that particular girdview rows.cells ? how will be pick and store a variable.
Please help me
|
|
|
|
|
when i write
public void ac<T>(int x,int y)
{
}
then what's the meaning of <T> here i this context.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
|
Sonia - you asked this self same question on Friday. I think you need to get a book on .NET 2 and have a read through it. This might save you a lot of wasted posting time.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I have a question regarding a regular expression within Regex.Split() method which will help me to break each line of code into tokens.
I'm trying to parse some lines of C# source code and split them into tokens.
My logic is very simple: construct a regular expression with 'operators and punctuators' which will serve as delimiters and split a string into array of tokens including those delimiters.
For example:
I have the following line of C# code
public static void DoStuff ( string[] strArray, int someArgument )
What regular expression should I use to get an array of tokens like this:
public
static
void
DoStuff
(
string
[
]
strArray
,
int
someArgument
)
And is it possible to include in that regular expression such delimiters as one line and multiline comments?
For example:
public /*should be private*/ static void DoStuff( string[] strArray ) //int someArgument )
after the split will result in:
public
/*should be private*/
static
void
DoStuff
(
string
[
]
strArray
)
//int someArgument )
And how to handle binary operators (delimiters) such as <<, >>, ==, !=, >=, or <= ?
Many thanks in advance.
|
|
|
|
|
This type of parsing is better handled by lexer/parsers. Antlr[^] is a nice parser generator, which has a C# parser[^] to get you started.
You can probably do the same thing with a regular expression, but it's going to be very complex.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Tom, absolutely this type of parsing is better handled by lexer/parsers. But for my purpose it will be much easier to construct rather long and complex regular expression than bring into play Antlr.
So far with my regular expression I can split only at unary operators-punctuators (like +,-,:,=,{,},[,] etc). Can somebody help me with binary as well (like ==, ++, --, != etc)?
So I coud have both just in one expression.
Or even simplier, how to have in one regular expression '=' and '==', '+' and '++', '-' and '--' respectively?
-- modified at 13:51 Monday 15th October, 2007
|
|
|
|
|
|
First of all, I would like to apologize if this question has already been asked and answered, but after a brisk look through the forum, I did not see a thread.
I would like to create an application that stores data inputted by the user, but am somewhat new at database deployment. I am used to using an SQL Server environment. What would be the best database to use between MS Access and SQL Server Express, and what would need to be added to the deployment package to use either of these. Example, if the user does not have MS Office installed, and I use MS Access as the database, what would I need to include in the deployment package to allow the application to use the database? If I use SQL Server Express, what needs to be installed on the client's computer to be able to use it?
Sorry for the newbie questions, but as stated earlier, I am not experienced in individual database applications.
Thank you for any help you can offer.
The Prodigy
"To err is human, to royally screw up requires a computer"
|
|
|
|