List Info

Thread: Re: Bound listbox freeze




Re: Bound listbox freeze
country flaguser name
United States
2007-12-17 11:23:16

Peter, thanks for the ideas.

This is the line that shows at the top of the call stack. Looks ok to me.

;         show2.exe!show2.Form1.listBox1_SelectedIndexChanged(object sender = {SelectedItem = "ainv"}, System.EventArgs e = {System.EventArgs}) Line 81       ;   C#

As the debug line below shows differently, it is a bit of a surprise that listBox1.SelectedItem returns “DataRowView221; rather than the item itself.

What: System.Data.DataRowView

I get around this by using:

listBox1.Text

 

This event handler seems to be where the form freezes (except for the listBox control itself):

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)

        {

           ; // Catches selection-click on listBox1 which is bound to an MS Access table.

           ; try

           ; {

           ;     //string curr2=listBox1.Text;     // Text from selected item.

           ;     //string curitem = listBox1.SelectedItem.ToString();     ;     // Debug

           ;     //Debug.WriteLine("What: " + curitem);         ;           ;    // Debug

           ;     //Debug.WriteLine("X: " + listBox1.SelectedIndex.ToString()); // Debug

           ;     //webBrowser1.Navigate("http://finance.google.com/finance?q=" + curr2);

           ;     //txtCurr1.Text = stocksBindingSource.Position.ToString();

           ;     Debug.WriteLine("Line for breakpoint.");

           ; }

           ; catch (Exception exception)

           ; {

           ;     Debug.WriteLine("Bug: " + exception.Message);

           ; }

        }

I am not getting any exceptions. Uncommenting any of the above lines does not change anything.

 

I don’t know what next step I can take to isolate the problem?

 

Pete

 

My permanent (forwarding) email address: world.oberlin.edu">petergumworld.oberlin.edu

 

-----Original Message-----
From: Peter Groenewegen [mailto:pgroenegmail.com]
Sent: Monday, December 17, 2007 11:05 AM
To: csharpgooglegroups.com; petergumworld.oberlin.edu
Subject: Re: [c#:601] Bound listbox freeze

 

You probably have a problem in your form which hangs the ui thread of the form. The controls in the webcontrol are in an other thread, this is why they still work. Try to find the problem in the winform application to fix the problem. Sometime you can run the application and when it hangs, break into the from with the debugger. if you are lucky you get the stacktrace of the call which causes your hanging.

 

--

Peter

On Dec 14, 2007 9:30 PM, Peter Gum <verizon.net">peter.gumverizon.net> wrote:

Using C# .NET 2.0, I have a form with a combobox of URLs, a webBrowser control and navigation controls. They all work as expected. I then added an Access-bound listbox whose text entries are used to form URLs. Selecting a listbox entry causes the combobox and navigation controls to stop working. Close (the form) stops working too. However, the listbox and webbrowser controls continue to function properly. Is it that the listbox will not give up focus? Why do events for the other controls stop firing?

 Is there a fix for this?

 peteg

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C# Community&quot; group.
To post to this group, send email to csharpgooglegroups.com
To unsubscribe from this group, send email to csharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/csharp?hl=en
-~----------~----~----~----~------~----~------~--~---
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )