|
Thanks
do you mean i have to lock the code that start the thread and gets the last added thread in the processThreadCollection to ensure that the number assigned to the thread is the correct number in the processThreadCollection ??
Thanks again
MiNa
|
|
|
|
|
Plz refere this code.............
using System;
using System.Threading;
class Database
{
public void SaveData(string text)
{
lock(this)
{
Console.WriteLine("Database.SaveData - Started");
Console.WriteLine("Database.SaveData - Working");
for (int i = 0; i < 100; i++)
{
Console.Write(text);
}
Console.WriteLine("\nDatabase.SaveData - Ended");
}
}
}
class ThreadLockApp
{
public static Database db = new Database();
public static void WorkerThreadMethod1()
{
Console.WriteLine("Worker thread #1 - Started");
Console.WriteLine
("Worker thread #1 - Calling Database.SaveData");
db.SaveData("x");
Console.WriteLine("Worker thread #1 - Returned from Output");
}
public static void WorkerThreadMethod2()
{
Console.WriteLine("Worker thread #2 - Started");
Console.WriteLine
("Worker thread #2 - Calling Database.SaveData");
db.SaveData("o");
Console.WriteLine("Worker thread #2 - Returned from Output");
}
public static void Main()
{
ThreadStart worker1 = new ThreadStart(WorkerThreadMethod1);
ThreadStart worker2 = new ThreadStart(WorkerThreadMethod2);
Console.WriteLine("Main - Creating worker threads");
Thread t1 = new Thread(worker1);
Thread t2 = new Thread(worker2);
t1.Start();
t2.Start();
}
}
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
i can understand your idea, but how this will help me to track the thread ?
and to know the state of t1 or t2 if it is waiting or suspended ...
Thanks again
MiNa
|
|
|
|
|
In MS Access, i can retrieve data from a table cell in a HTML page using Webbrowser like this:
txtResult = WebBrowser0.Document.all.tags("Table")(TableNum).Rows(Row).Cells(Col).innertext
But i can't find the way to do the same thing in C# Can I get some hints pls?
|
|
|
|
|
pls try this
via java script.........
var table = document.getElementById("tableId");
var row = table.rows[2];
var cell = row.cells[0];
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Ty for your reply. I can do it in Access and java also. But in C# i guess i must use the HTMLTable to get the table. But i still cant find how to use it through Webbrowser.
|
|
|
|
|
how to programming a program that store a DXF(Autocad File) in SQLSERVER And be able zoom in/out ?
|
|
|
|
|
I have this problem:
I want to open in a notepad some text from my exe application. Should be something like view source in IE.
I have a textbox where I have a lot of text. And, because it's difficult to edit text in a text box, I thought that is much easy to send that text to a notepad window. BUT... I don't want to save the text before to open it in notepad.
Any suggestion?
Thanks!
|
|
|
|
|
Wat do u mean ":it's difficult to edit" do u want to format(font/size) the text or juz copy/paste options.. if you want format then design a notepad of urself..(or search google to get the same) or use richtext box for minimal formatting.
RB contains builtin functions to format/edit
|
|
|
|
|
Could it be that you do not have the MultiLine property set to true. That could make a lot of different when editing a zillion line text file. When you have multiline set to true than you can edit the width/height of the control so more text is visible both vertically and horizontally.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
What i need is a way to paste some text from another application, to a running notepad.
|
|
|
|
|
You could try to transfer the text using the clipboard:
select and copy in your app, then send key events for CTRL/V to the window of your
target app. You would have to find the process ID, its main window, and perform
either a SendMessage, SendKey or SendInput.
There is an MSDN article explaining SendInput is "more reliable" than SendKey ?!?!
I have not done this myself (I created my own editor though).
Luc Pattyn
|
|
|
|
|
Thanks Luc,
I'll try to do what u suggested - and the idea with my editor is also good. It's not so difficult to do an simple text editor.
|
|
|
|
|
Using the clipboard like that is not good practice. What if the user has something in the clipbaord that they want to be there?
What's so bad about saving a temp txt file to open with notepad?
|
|
|
|
|
If I save the file and open it in a notepad after this, when the user do save, the file is saved in that location, and this is what i want to prevent. I want that notepad, when the user chose to save that text, to open a save dialog, and to ask the user the name/location for that file.
And about the clipboard.... the things stocked in it are temporary, and supposedly are not so important! (or can be recovered at any time)
|
|
|
|
|
Hi,
I'm having a problem with generics and reflection, trying to create an instance of a System.Action<> delegate and invoking it. I'm doing this:
Type type = typeof( Action<> ).MakeGenericType( new Type[] { typeof( string ) } );
So far so good. However, I can't figure out how to use Activator to create an instance of this so I can invoke it. The constructor for Action<> takes a "void (string) target", and I don't know how to express this in a call to Activator.CreateInstance. I.e., following the line above:
System.Delegate del = (System.Delegate)Activator.CreateInstance( type, new object[] { what_goes_here? } );
Anyone have a clue how to achieve this?
|
|
|
|
|
Search this message board for "Activator" using the "search comment" button.
Luc Pattyn
|
|
|
|
|
I'M a c# and java programmer and i wanna specialized in two category
symbian c++ and web services but i have low experiance and i wanna some1 help me from where i can start in both fields
articales or ebooks or recommendation for sites
plz plz plz ream my mail and send reply
|
|
|
|
|
hi ,
anyone know how add events to the titlebar of a windows form ?
for eg , if i click on titlebar only titlebar shld be visible and the rest of the form hidden.and clicking again unhides the form ,like that .
Thanks for u'r time
|
|
|
|
|
You can use the WndProc for the form and filter the a combination of the following events:
private const int WM_NCLBUTTONDBLCLK = 0xA3;<br />
private const int WM_NCLBUTTONDOWN = 0xA1;<br />
private const int WM_NCLBUTTONUP = 0xA2;
When the event fires you can change the size of the form that received the event. If the form height is lessthan or equal to 0 then change the height to the normal height. If the form height is the normal height then reduce the height to 0.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
how can i make a rollover menu that shows submenus when rolled over - like the green top right menu here on codeproject.com - when rolling over the "Message Board" menu for example it opens the submenus (windows vista,visual C++,Alt/WTL/STL,COM,C++ etc.).is it possile with Dreamweaver? or generally what code should i write.
tx.
|
|
|
|
|
Would this be better suited in the asp.net forum?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
i have a windows service which spans athread whne started
protected override void OnStart(string[] args)
{
Thread mythread= new Thread(new ThreadStart(Run));
mythread.Start();
}
it makes a webrequest(webmethod) in every 10 seconds but sometime i get an exception(only some times) there was not enough thread pool to complete the opertaion why do i get this mesage and what should i do remove this.
thank you
|
|
|
|
|
How to check that I'm connected on the internet with C#.
Help.
Vasildb
|
|
|
|
|
Register the event in the class
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
and in the event handler check for the Internet availability
void NetworkChange_NetworkAvailabilityChanged(object sender, System.Net.NetworkInformation.NetworkAvailabilityEventArgs e)<br />
{<br />
if (!e.IsAvailable)<br />
{<br />
MessageBox.Show("N/W DISCONNECTED"); <br />
}<br />
}
|
|
|
|