|
So what? He is trying again and may have better luck. Why didn't you just ignore his post?
|
|
|
|
|
Hello,
Why are you doing the "Join()"?
What do the Methods of the Threads do?
What are the results you are expecting and where do you get them from?
All the best,
Martin
|
|
|
|
|
hi,
thanks for reply.
I am joining 3 threads with Join() method. Then 3 threads can execute parallary.
There are 3 methods ,all are return same types of arrays.
|
|
|
|
|
Hi!
The whole while(... construct is superfluous.
You start 3 threads and then call Join() for each of them.
So the last Join() will return only when NormalThread has finished and the other two threads have finished as well.
Depending on how you access the thread's "results", declaring the respective members as volatile might help.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I suggest using 3 AutoResetEvent that each thread would Set() when done. So, you start your three thread, and then, in your main thread, do a WaitHandle.WaitAll(....). It would be advised to use the overload with a timeout.
Your code could look something like this:
public MyClass
{
private AutoResetEvent _specialEvent = new AutoResetEvent();
private AutoResetEvent _normalEvent = new AutoResetEvent();
private AutoResetEvent _bulkEvent = new AutoResetEvent();
public threadtest()
{
Thread SpecialThread = new Thread(new ThreadStart(this.GetSpecial));
Thread BulkThread = new Thread(new ThreadStart(this.GetBulk));
Thread NormalThread = new Thread(new ThreadStart(this.GetNormal));
SpecialThread.Start();
BulkThread.Start();
NormalThread.Start();
WaitHandle.WaitAll(new WaitHandle[] { this._specialEvent, this._normalEvent, this._bulkEvent } );
}
public GetNormal()
{
this._normalEvent.Set();
}
public GetSpecial()
{
this._specialEvent.Set();
}
public GetBulk()
{
this._bulkEvent.Set();
}
}
You could consider using the BackgroundWorker class also.
|
|
|
|
|
Hi,
thanks a lot for reply. I will check with your codes and comeback soon.
Is there a problem ,when I am using Join() method?.
I need to run my 3 methods paralaly. all the 3 methods return same type of arrays.
|
|
|
|
|
Hi,
we have a requirement that we have to suppress/deactivate all other applications except one application(running). Can we accomplish this using C# or VB.net? could you please help me to finish this task?
For example, if we open one application, all other applications should be suppressed/deactivated. (means we should give access for only one application for the users).
Thanks in Advance
SMARTech
|
|
|
|
|
The practical answer is no. There are too many processes in the system that are required to keep your application aloft for a start.
You could, for example, attempt to increase the priority of your application above all others but this would have a detrimental effect. Again, because your application relies on parts of the operating system doing its job it won't help if the OS cannot do its job because your application is elevated above it.
I am, however, extremely suspicious of why you might want to prevent other applications running in the OS while your application is running. It sounds like something a virus or trojan would want to do.
|
|
|
|
|
Colin Angus Mackay,
Thanks for you quick response, I dont want to prevent the services of OS, I just dont want to give access to the user for other applications except the one. how to prevent the user to access all other applications except the one application (running)? could you please help in this issue?
Thanks
SMARTech
|
|
|
|
|
You can't do it from your code. This is something that's done using Group Policy in Windows. You can specify a list of applications that the user, or group of users, is allowed to run. THis is NOT something you can just turn on and off only when your application runs.
For further information, pickup the Windows XP or Windows 2003 Resource Kit. Group Policy is explained in there, taking up about half the book.
|
|
|
|
|
That sounds extremely user-hostile; don't expect anyone to want to use your application.
|
|
|
|
|
Hello,
My intention is not to force the user to use my application, but to give the access for only one application. Except that, the user could not open other applications on the system.
Thanks,
SMARTech
|
|
|
|
|
shah_tech wrote: My intention is not to force the user to use my application, but to give the access for only one application. Except that, the user could not open other applications on the system.
So forcing the user to user your application once it's running, even if it's only to turn the damn thing off. Sorry, but this sounds like malware - you are running totally contra to what a multitasking system should do. You still haven't explained why you would WANT to write an application that did this? Why do you want to alienate users?
|
|
|
|
|
So they can't even check their email while using it?
They can't lock the system for a potty break?
They would have to exit your app to do something else for a moment and then get back in?
If it hangs they can't get to the Task Manager to kill it?
|
|
|
|
|
yes, they should not be allowed for other applications while running my application, Can you please help?
|
|
|
|
|
I wouldn't even if I could. No one would want to use such a system. I certainly wouldn't, would you?
|
|
|
|
|
I created a MDI form & its child,
On child form I am doing database interaction and loading
the datatable object with table name "table1".
after doing all this when i run the MDI form & open up the child from,
its giving the following error:
"Cannot create a child list for the field table1"
Will anyone tells me the reason, or how to rectify this?
Thanks & regards to all.
|
|
|
|
|
|
Here somthing more if u can help?
When i try developing the same application using the VS designer its working fine, I created the MDI form, on its child form thru connection wizard i created the connection, dataadapter, dataset.
And write the correponding code for manipulating the data on child form,
everything working fine.
But when i am doing this thru coding, error is generating which i had mention earlier.
What i am doing is:
-> created a seprate class, on this creating the DB connectivity,
-> create the commandBuilder object, and the GetUpdateCommand, GetUpdateDelete, GetUpdateInsert.
-> filling the datatable object, returning it to child form class file.
on child class file performing the function.
Also when i compare the VS designer code & my code, some lines i am unable to understand like:
((System.ComponentMode1.IsupportIntialize)(this.dsComp)).BeginInit();
((System.ComponentMode1.IsupportIntialize)(this.dsComp)).EndInit();
And also i want to know what is difference when we creating DB connection thru wizard & connection thru coding?
which method one should use?
|
|
|
|
|
I'm using SQL Server 2005 as backend for C#.Net 2005. When I am trying to connnect the database which is in other system, it thrown the following exception..
"Login failed for user ''. The user is not associated with a trusted SQL Server connection."
Connection string is
SqlConnection conn = new SqlConnection("Data Source=Danny\\SQLExpress;initial catalog=Games;trusted_connection=true;user=sa;pwd=lalitha");
Please guide me to solve this..
Regards,
Lalitha.
modified on Thursday, February 21, 2008 6:26 AM
|
|
|
|
|
Hi,
you have connection string:
Connection string is
SqlConnection conn = new SqlConnection("Data Source=Danny\\SQLExpress;initial catalog=Games;trusted_connection=true;user=sa;pwd=lalitha");
you have given trusted_connection=true, given user and password details.
If you have access to Sql server with windows authentication, you should provide trusted_connection=true in connection string,
else you have to provide user and pwd details.
your connection string should be in either formats:
1. Data Source=Danny\\SQLExpress;initial Catalog=Games;trusted_connection=true
2. Data Source=Danny\\SQLExpress;initial Catalog=Games;user=sa;pwd=lalitha
If you specify trusted_connection=true, you need not to give user and pwd details.
I think you dont have windows authentication for SQL server, so you are getting error like above.
try with 2nd option of connection string, it should work
All the best!
|
|
|
|
|
|
Good idea removing that IP address
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Hello Lalitha,
The SQL Server seems to be configured for Windows Authentication and you are trying to connect to the server using SQL Login. Either Change the Authentication mode to Mixed Mode or Connect using your domain account
http://support.microsoft.com/kb/555332
Regards,
Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
Has anyone used NetworkStreams asynchronously? How do things change if you wrap the NetworkStream in an SSLStream?
Can I run two threads using the same stream calling receive and send on it at the same time or will I have to use async callbacks?
|
|
|
|