|
What does Main do? Surely your switch case is not inside Main . Also, posting the relevant piece of code would help.
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
Mystic_ wrote: i can send the sample code if someone may wish to see it.
How about just the switch snippet statement and the line where the app freezes? That would be the most helpful and is your best bet to get an answer to your question.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
to give u idea of what iam saying.
this is just a picture of what iam trying to imply
i have a class
public class Form1 : System.Windows.Forms.Form
{
public struct Data
{
public int data;
public Element_tg element;
}
public class Element_tg
{
public string elementstr;
public int count;
public bool last;
public int set_ele;
public Element_tg child;
public Element_tg parent;
}
pubic class ThreadProp
{
public static Data info1,info2;
public static string file1,file2;
public static string origin;
public static string filename;
public static bool nav;
public static NameValueCollection nvcol;
public static string url;
public static Uri uri;
public static string result;
public void Ext_Text()// uses string file1, Data info1,
bool nav
{
//uses a com component and rest all is simple programming
/ /its a lengthy code
}
public void Test_Download()// uses string file2, Data
info2,string origin,string filename
{
//call another function which interacts with internet for
downloads
}
public void WebInteract()//uses string url, (this ones not
necessary) string type,NameValueCollection nvcol
{
//this one also interacts with internet
}
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void bt_load_Click(object sender, System.EventArgs e)
{
ThreadProp tr=new ThreadProp();
switch()
{
case 1:
Thread thrr=new Thread(new ThreadStart(tr.Ext_Text));
thrr.Start();
break;
case 2:
Thread thrr=new Thread(new ThreadStart(tr.Test_Download));
thrr.Start();
break;
case 3:
Thread thrr=new Thread(new ThreadStart(tr. WebInteract));
thrr.Start();
break;
}
}
}
-- modified at 19:02 Monday 17th July, 2006
|
|
|
|
|
now let me state the problem again.
problem is this that i used multithreading to remove this short comming from my program, that it halts when in execution.
even with multiple threads its halt when executing. that is it dont respond to gui interaction.
its GUI freezes. i used ThreadPool too but that wont solve my problem either.
|
|
|
|
|
Thread thread = new Thread(new ThreadStart())
thread.Start()
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
sorry. that was just a typing mistake. in actual, in source code, it is with Start() method. every thing is getting executed,including threads, but problem is the same. of GUI getting frozen
|
|
|
|
|
I would put some tracing in a few of those functions to try and narrow down the bottle-neck. For instance, put a System.Diagnostics.Trace.WriteLine call before and after you spawn the new thread. Also put in a trace inside each thread function, at the beginning and at the end. Run the program in debug mode and check the output.
It would be particularly helpful to know if your main thread is getting stuck on Thread.Start or on some subsequent function.
Sincerely,
Alexander Wiseman
|
|
|
|
|
i will try that one out. thanx
|
|
|
|
|
If you want, you can post the trace output on the forum here and I'll see if I can help.
Sincerely,
Alexander Wiseman
|
|
|
|
|
my application is GUI based so where does Trace write its messages. how can i find them?
|
|
|
|
|
There are two ways to see the output:
First, the quick and easy way:
1) If you're using Visual Studio, then run the program in debug mode by pressing F5. When the program exits, you can see all of the trace output in the "Output" window - the same window in which you see the results of the last Build command. In VS 2003 (and I think it is probably in 2002 as well), there is a drop-down box which allows you to select what kind of output you wish to view. After running the program in debug mode, my VS window shows two options "Build" and "Debug". If you set it on "Debug", you should see the trace output.
Second, the way which takes a little bit longer, but results are more permanent:
2) Setup a TextWriterTraceListener which will automatically write trace output to a file. Here's how: first, you'll need to make sure you reference the System.Diagnostics namespace in your main form file:
using System.Diagnostics; Second, put a variable in your main form code:
private TextWriterTraceListener myListener; Now, put the following code into your application's main form constructor, or Load event handler:
myListener = new TextWriterTraceListener("logFile.txt");
Trace.Listeners.Add(myListener); And you're done! Run the program and then look at the file "logFile.txt" for the output.
Hope that helps! Let me know what you find.
Sincerely,
Alexander Wiseman
|
|
|
|
|
its in the start of web interaction
its in the end of Web interaction
its in the start of text extract
its in the end of text extract
'Testing.exe': Loaded 'c:\windows\assembly\gac\microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\microsoft.mshtml.dll', No symbols loaded.
The thread '<no name="">' (0xc9c) has exited with code 0 (0x0).
'Testing.exe': Loaded 'c:\windows\assembly\gac\custommarshalers\1.0.5000.0__b03f5f7f11d50a3a\custommarshalers.dll', No symbols loaded.
The thread '<no name="">' (0xf78) has exited with code 0 (0x0).
|
|
|
|
|
i read it and both the threads which should start r getting started. but GUI still freezes while these two threads execute.
|
|
|
|
|
Did you put a trace command after the new Thread(new ThreadStart(...)) line in the main code? If not, try that first. If so, did it get output? That is an important point because it will determine whether your main application is getting stuck on the creation of the thread, or on a subsequent call.
Sincerely,
Alexander Wiseman
|
|
|
|
|
its in the start of web interaction
its in the end of Web interaction
its in the start of text extract
its in the end of text extract
'Testing.exe': Loaded 'c:\windows\assembly\gac\microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\microsoft.mshtml.dll', No symbols loaded.
The thread '' (0xc9c) has exited with code 0 (0x0).
'Testing.exe': Loaded 'c:\windows\assembly\gac\custommarshalers\1.0.5000.0__b03f5f7f11d50a3a\custommarshalers.dll', No symbols loaded.
The thread '' (0xf78) has exited with code 0 (0x0).
The four starting lines r produced by Trace.
"its in the start of web interaction" was written before one .Start() method and the "its in the end of Web interaction" is used after .Start() method and same applies to the 2 lines below that. they r giving output
|
|
|
|
|
It seems to me that you are actually getting the trace output after you call Thread.Start and before the generated thread finishes. This suggests that your thread starting code isn't a problem at all, but perhaps something that your main code is doing after it starts the threads is causing the GUI to lock up. I would look closely at the code which gets executed on your main thread after you start the worker threads (I don't think you posted that code on the boards).
Sincerely,
Alexander Wiseman
|
|
|
|
|
its all the main() had. main function has only this
static void Main()
{
Application.Run(new Form1());
}
as i said reall execution, that is bussiness logic, when i click the button.
so all the code in
private void bt_load_Click(object sender, System.EventArgs e)
{
}
its getting more and more tricky. isnt it??
|
|
|
|
|
hi i had treeview which is filled form databse.when i add new item and update the treeview(refill it) then it collapses,can i get its previous position and reopen it at that pt where it was /or prevent it from collapsing. Thank in advance
Tasleem Arif
|
|
|
|
|
Or I suppose you want the answer too. TreeView.SelectedNode and TreeView.SelectedNode.Expand
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
try
{
txtUserId.Text=tvAdmin.SelectedNode.Text;
TreeNode Node= new TreeNode();
Node=tvAdmin.SelectedNode;
General obj=new General();
obj.FillTVAdmin(tvAdmin,"SELECT Name FROM any");
tvAdmin.SelectedNode=Node;
tvAdmin.SelectedNode.Expand();
}
catch(System.Exception p)
MessageBox.Show(p.Message);
it think u was talking abou this bu this gives exception
object refrence not set to the instance of object
Tasleem Arif
|
|
|
|
|
If I understand you correctly, you want all of the nodes to retain their expansion state upon a complete reload of the tree's nodes. If so, you'll need to cache the expansion state of each node somewhere, reload the tree, and then walk over the entire tree and set each node's expansion state to the saved value. Unless the new values are being inserted at the bottom of the tree, you'll have to be careful not to give them the expansion state of a node which already existed. This[^] utility class might help you with this task.
:josh:
My WPF Blog[^]
|
|
|
|
|
Hi folks!
.NET 2.0 has this very practical feature to throw an InvalidOperationException when an application is run in the debugger and accessing UI elements that were created on a different thread.
Does anyone know if there's a chance to enable this feature for a .NET 1.1 application without converting the whole application from VS2003 to VS2005?
I've tried setting the supportedRuntime to v2.0.20757 in the App.config file, but that didn't work (VS2003 doesn't start the application any more and attaching the VS2005 debugger after starting the application manually doesn't throw the exception at all).
Is there a way?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
When I am organizing a table in an application, I do not know beforehand how many columns it will contain.
In the Visual Studio-2003 I made it dinamically through command series:
theGrid.Columns.Clear();
theTable.Columns.Clear();
for (i=0; i < val; i++) {
theTable.Columns.Add();
}
for (i=0; i < val; i++) {
acol= new DataGridViewColumn();
theGrid.Columns.Add(acol);
}
But when I use the Visual Studio-2005 with its new dataGridView , these commands do not have the effect.
Though headers are OK, the table by itself is just empty, whereas the data are written into it OK.
What can I do to get the data in its grids will be shown?
HilSoft
|
|
|
|
|
I'm not an expert on this, but whenever I use the datagridviews, I always bind to a dataset or something else behind it. But you also have to define the data types in the dataset as well as the datagrid so it knows how to display it.
|
|
|
|
|
Of course, a have a DataSet1, which is bound with my datagridview. The Table1 is a part of the DataSet1. In Visual Studio-2003 (with DataGrid) all this works just OK. The trouble arises only when I'm starting use VS-2005 and changing DataGrid for DataGridView.
HilSoft
|
|
|
|