|
You can use the ThreadPool class provided by the .NET Framework, but it's not really recommended for executing long running operations (in the order of 20 seconds). You can find plenty of implementations for ThreadPools if you search around in CP. In any case, the idea is the same.
void YourMainFunc()
{
for (int i =0; i<listOfIPs.Length; ++i)
{
ThreadPool.QueueItem(ThreadFunc, listOfIPs[i]);
}
}
void ThreadFunc(string IP)
{
if (SuccessfulQuery(IP))
{
UpdateDataSet(IP);
}
}
void UpdateDataSet(IP)
{
lock(xyz)
{
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
what is "xyz" in lock function?
|
|
|
|
|
Any object, I put a lock statement just to indicate that the Dataset might be accessed by multiple threads, so you need to some kind of synchronization.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
How do i deal with the case of recovering communication between client and server if one of them has just restarted?
At the moment if I close my client (after succesful communication) and restart it, i can't communicate with my server, i have to close down the server and restart that too. What am i missing?
Any help greatly appreciated.
Thanks in advance
Duffs
|
|
|
|
|
For ASP.NET and the language?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Is there an easy way of passing mouse events from a control to the form below in, e.g i have a label on the form and want any mouse events that happen on the label to be passed to the form underneath it.
I cant just disable the label (e.g. label.Enabled = false) as i still want the label to be able to respond to the events before the form.
My only idea is to send another message to the form when the label recives it, but this seems a little long winded.
Barry
|
|
|
|
|
wheelerbarry wrote: My only idea is to send another message to the form when the label recives it, but this seems a little long winded.
And it's the only way to do it. Mouse clicks will not go to all (or selected) windows beneath the spot where the mouse was. You actually have to create a new mouse message and manually send it to the windows you want. For this, you'll have to have the window's handle (hWnd).
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can I have my richtextbox accept a tab correctly?curently when I press the tab key, it does not do anything .
thanks
regards paula
|
|
|
|
|
Why not try the AcceptsTab property?
Regards,
mav
|
|
|
|
|
i need help plz
i want to open web Page in my program without use internet Explorer
Just by using my program and Set value to textbox and then Push Submit button
after taht i will have sisson from this site , i want to access another page inthe site and make check to CheckBox
Ex:
i want my program to open http://www.mysite.com/login.aspx
and set user name & password to textbox in the login page and push SUBMIT button
then i will have sisson from this site to assecc http://www.mysite.com/myacount.aspx
i want to make check to checkbox in this page
-----------------------------------------------------------
Palestine
|
|
|
|
|
|
You'll need to create your parameters and handle your response...and I'm guessing you are POSTing...
private string GetResponse(string URI, string Parameters)
{
WebRequest webRequest = WebRequest.Create(URI);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "POST";
// data
byte [] bytes = System.Text.Encoding.ASCII.GetBytes(Parameters);
webRequest.ContentLength = bytes.Length;
Stream os = webRequest.GetRequestStream();
os.Write (bytes, 0, bytes.Length);
os.Close ();
// response
WebResponse webResponse = webRequest.GetResponse();
Stream s = webResponse.GetResponseStream();
StreamReader streamReader = new StreamReader(s);
return streamReader.ReadToEnd().Trim();
}
Hope this helps!
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Hello!
I have a windows form that, by use of a menu, opens another window (not an MDI child). When I close this new window, the form also closes. How can I prevent this from hapenning?
Thank you,
Patrícia Gonçalves
|
|
|
|
|
You can try with a modal window...
<br />
Form1 form = new Form1;<br />
form.ShowDialog();<br />
try this..
hope it helps ^^
|
|
|
|
|
how can i connect two clients knowing their ip addresses but each one
may be using different or same connection type Like may be DSL or
Dialup connection by knowing ip addresses ?
Additionally, i programmd two applications one is the server and one is
the client.
I gave the client application to my friend on the internet through
yahoo messenger chatting and i gave him my ip address and then i ran my
server listening on specific port and on my current ip address which i
took from my dial up connection but this is not useful because the
client gave him an exception telling him that (the server can't be
found) That means he didn't see my ip address as connected device
through the network may be this is because iam behind firewall but my
pc already doesn't have any firewall plugged in or may be Iam behind
NAT !!!! ok but if my ip address is private address which made my
friend can't logged in into my server application so what is the
solution ?
Mess With The Best And Die Like The Rest
|
|
|
|
|
Find out your public IP address.
whatismyip[^]
---
b { font-weight: normal; }
|
|
|
|
|
I am looking for a TextBox control that would allow entering numbers only and with a digit grouping, the same way that Calculator does it in Windows XP when digit grouping is switched on.
Is there a control that can do it, or is it possible with standard windows forms textbox control?
Tnx in advance
Dragan
|
|
|
|
|
Just try in it, and post here your problems and questions, and try to use the standard TextBox and use its events like TextChanged and do your custom code within it.
"I am a lair" Is this statement true or false ?
|
|
|
|
|
Yea - roll your own and the keep it for use in other projects...
LongHC - Yes you are, you must be... if your were not then you would not be able to make that statement.
MCSD(VB6/SQL7)
MCAD(C#/SQL2000)
MCSD(C#/SQL2000)
-- modified at 6:52 Friday 4th November, 2005
|
|
|
|
|
If I am, then I am in this statement, thus it is not true; thus I am not
"I am a lair" Is this statement true or false ?
|
|
|
|
|
If you are not a liar then you can not make that statement.
If you are a liar then you don't always have to lie, so you can make that statement.
Therefore you are.
You must be....
MCSD(VB6/SQL7)
MCAD(C#/SQL2000)
MCSD(C#/SQL2000)
-- modified at 8:41 Friday 4th November, 2005
|
|
|
|
|
I got this:
Process tx = Process.GetProcessesByName("process name");<br />
tx.Kill();
but it says that you cant convert System.Diagnostics.Process[] to just System.Diagnostics.Process.
|
|
|
|
|
Well, that's because GetProcessesByName returns an array of Process objects, which is exactly what the error message says. You need to iterate through the array and Kill() on each one.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I dont know how to do that
|
|
|
|
|
I think it would be better if you read a book that teaches basic C# constructs before proceeding any further. You really should know how to loop over an array.
foreach(Process process in Process.GetProcessesByName(...))
{
process.Kill();
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|