|
You need to tell the thread to stop so that it can cleanup its resources and exit:
[RE-EDIT]
bool runListener = true;
private void StartListening()
{
listener.Start();
while (runListener)
{
if (listener.Pending())
{
Networks user = new Networks(listener.AcceptTcpClient());
}
else
{
Thread.Sleep(250);
}
}
listener.Stop();
}
then in the FormClosing event (or wherever you're doing cleanup) set runListener to false.
Also, if you set the thread's IsBackground property to true then the thread won't cause the program to remain alive even if it isn't terminated before the form closes.
Control.CheckForIllegalCrossThreadCalls = false; And that's just completely uncalled for.
|
|
|
|
|
Thanks. It worked.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Glad to help
|
|
|
|
|
Thanks again for the optimization.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Hi to all
I need a component for convert text to speech and speech to text
|
|
|
|
|
|
Hello
can help me in my problem.I need deal with very big number to add,sub,multi and divide I can do the add,sub and multi but can't do the divide can help me.
I need divide very long integer number such that
x=444444444444444444444444444444444444444444444444444444444444444444444444
y=3333333333333333333333333333333333333333333333333333333
or more that each number consist from more of 300 digit can I divide it and result is div and mod.
thanks.
|
|
|
|
|
I can't see any possible application for that sort of number crunching. What is a 300 digit integer anyway?
Look at the maximum sizes of the datatypes, you're going to find you can't actually store numbers that big.
|
|
|
|
|
Apologies for a severely lacking knowledge of the datatypes. At least I can go home today knowing I learnt something.
|
|
|
|
|
hammerstein05 wrote: I can go home today knowing I learnt something
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
hu_kh00 wrote: I need deal with very big number
Try one of the BigInt[^] implementations
I are Troll
|
|
|
|
|
IIRC Microsoft J#[^] has a BigInt implementation that can be used by any .NET language. It looks like they're dropping j# so get it while you can!
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
J# has lost all support long ago. I did use its BigInt on occasion.
There finally is a bit integer type in .NET, I haven't tested it yet, I'll wait for an official 4.0 release...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
I used to divide bit-by-bit with the standard binary long division, which gives the quotient and the remainder at the same time. But there are faster ways, such as SRT division (quite complicated though)
|
|
|
|
|
I have a problem...
public delegate MyDelegate()
class MDIParent
{
public event MyDelegate myEvent;
public MDIParent() //Constructor
{
// Create and open MDIChild from MDIParent Constructor
MDIChild mdiForm = new (MDIChild())
}
Class MDIChild
{
public MDIChild //Constructor
{
((MDIParent)this.MdiParent).myEvent += new MyDelegate(myPriveteMethod);
}
}
Well, as you can see, I
- Auntomatcally create a MDIChild from MDIParent constructor
- In the MDIChild constructor I try to suscribe to an MDIParent event
It gives me a SystemNullException. It perfectly suscribes if I do it OUTSIDE the MDIChildForm constructor. I suppose it is becouse parent form is not still initialized (child is created form INSIDE parent's constructor).
I need to open MDIChild from the begginig, and suscribe to event at the begginning, too. Any workaround to do this without using the constructor
Thanks!
|
|
|
|
|
Kaikus wrote: Auntomatcally
You're defining extended relationships in your code.
|
|
|
|
|
How about passing MDIParent instance into MDIChild 's constructor?
class MDIParent
{
public event MyDelegate myEvent;
public MDIParent()
{
MDIChild mdiForm = new MDIChild(this);
}
Class MDIChild
{
public MDIChild(MDIParent parent)
{
parent.myEvent += new MyDelegate(myPriveteMethod);
}
}
Best wishes,
Navaneeth
|
|
|
|
|
The issue is that the MdiParent is not set within the construction of your child window. It's a property you set after the MDIChild has been created. You could create a register method on your child class and after you've set the MDIParent of the class, call MDIChild.Register( ).
Not the best way, I'm certain, however it would do what you needed.
|
|
|
|
|
Thanks!
I knew that was the problem. Parent was not completely set becouse I tried to suscribe inside child constructor, wich was invoked from the parent constructor.
I tried your suggestion. It worked! But, how, and when to suscribe?
Today morning, after a good rest, everything came clear. I just moved the suscription to the Forn_Load event
Thanks!
|
|
|
|
|
Hi,
Can anyone let me know How to make Shapes window invisible through programmatically.
Thanks in advance.
|
|
|
|
|
I got the answer. Below is the solution
Microsoft.Office.Interop.Visio.Application vsoApplication = vsoDocument.Application;
vsoApplication.ActiveWindow.Windows.get_ItemFromID((int)Visio.VisWinTypes.visWinIDShapeSearch).Close();
|
|
|
|
|
Hi
I have installed sql sever 2008 first then SQL Server 2005.
Now when i connect with dot(.) in sql server 2008 it works fine
but when i try to connect to sql sever 2005 with dot(.) or local it doesnt works!
What should i do?
|
|
|
|
|
Probably post in the SQL forum. What do you mean dot(.)? If you've got them side by side then you'll have different instances. The instance will be part of the connection string.
Regards,
Rob Philpott.
|
|
|
|
|
1)sorry .I didnt find SQL forum.
2)dot(.) ===> . instance or local
3)where i can find instances of sql server 2005
|
|
|
|
|
Each instance of SQL Server on a system must have a unique name.
|
|
|
|