Click here to Skip to main content
15,914,488 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting byte[] to Hex String; Pin
Heath Stewart24-Jun-04 12:42
protectorHeath Stewart24-Jun-04 12:42 
GeneralRe: Converting byte[] to Hex String; Pin
Bo Hunter24-Jun-04 14:24
Bo Hunter24-Jun-04 14:24 
GeneralRe: Converting byte[] to Hex String; Pin
Heath Stewart25-Jun-04 3:33
protectorHeath Stewart25-Jun-04 3:33 
GeneralRe: Converting byte[] to Hex String; Pin
Bo Hunter25-Jun-04 13:05
Bo Hunter25-Jun-04 13:05 
GeneralRe: Converting byte[] to Hex String; Pin
Karl 200027-Jun-04 10:16
Karl 200027-Jun-04 10:16 
GeneralRe: Converting byte[] to Hex String; Pin
Heath Stewart27-Jun-04 17:37
protectorHeath Stewart27-Jun-04 17:37 
GeneralRe: Converting byte[] to Hex String; Pin
Karl 200027-Jun-04 10:08
Karl 200027-Jun-04 10:08 
GeneralClearing Panel from Event Handler Pin
RobertVG24-Jun-04 11:21
RobertVG24-Jun-04 11:21 
Background: Winforms Dialog Application, .NET 2003

Overview:
1 form, contains:
panel for main content
panel for navigation

2 custom controls loaded into main forms depending on scenario

1 class containing my event

Description:

This is apparently beyond the scope of the issue but may be important.
The app starts, it loads one of the childern controls into the form's main content panel. It passes the event class as a parameter. A user clicks on an item in the control, the event class's public method is called with the items id. The class functions internally calling the delegate, etc. The main form catches the event and proceeds to switch the main panel's control.

Up to this point the application functions properly. Now heres the oddity I have found. The event handler gets triggered, does some processing and then calls:

PanelMain.Controls.Clear();

// set control
tabbed = new CtrlMainTabbed( m_meeting );

// Load tabbed control onto main panel
this.PanelMain.Controls.Add(tabbed);

// Add the Panel to the Form.
this.Controls.Add(PanelMain);

The issue: the control is loaded properly and functions nicely if ann ONLY IF the next mouse click occurs in the application. If the mouse is clicked on any other application, or if a MessageBox is spawned by that method, the application reaches an inactive state. The title bar becomes a light blue, and the application will not recieve events. Now as I mentioned, if the application is clicked immediatly after the swirching of the panel contents, all functions normally.

I have isolated the problem to PanelMain.Controls.Clear();
I have also tried PanelMain.Controls.Remove( myItem1 );

Both result in this behavior.

I have tried calling invalidate to repaint the panel / form, along with numerous other ideas, that I will not bother with here. My assumption is that there is an event in the message pump that isnt being dealt with properly, most likely the result of me calling Clear on the panels contents.

Also, I have tried simply running the app and loading the panels, then clearing it and then loading it again and this works properly.

So what I'm gathering is the delegate and the clear event are not behaving well together. The issue appears to me to be related to the events / threads.

Keeping in mind I may be way off in my assessment, does anyone have any ideas?





GeneralRe: Clearing Panel from Event Handler Pin
Heath Stewart24-Jun-04 12:25
protectorHeath Stewart24-Jun-04 12:25 
GeneralRe: Clearing Panel from Event Handler Pin
RobertVG24-Jun-04 13:55
RobertVG24-Jun-04 13:55 
GeneralRe: Clearing Panel from Event Handler Pin
RobertVG24-Jun-04 13:56
RobertVG24-Jun-04 13:56 
GeneralRe: Clearing Panel from Event Handler Pin
RobertVG24-Jun-04 14:11
RobertVG24-Jun-04 14:11 
GeneralConcurrency Pin
IamADotNetGuy24-Jun-04 10:01
IamADotNetGuy24-Jun-04 10:01 
GeneralRe: Concurrency Pin
Dave Kreskowiak24-Jun-04 10:17
mveDave Kreskowiak24-Jun-04 10:17 
GeneralRe: Concurrency Pin
Xiangyang Liu 刘向阳24-Jun-04 17:13
Xiangyang Liu 刘向阳24-Jun-04 17:13 
GeneralDetaching event handlers Pin
Flack24-Jun-04 9:57
Flack24-Jun-04 9:57 
GeneralRe: Detaching event handlers Pin
Heath Stewart24-Jun-04 10:27
protectorHeath Stewart24-Jun-04 10:27 
GeneralNeed PDF help Pin
Unforsacable24-Jun-04 9:35
Unforsacable24-Jun-04 9:35 
GeneralRe: Need PDF help Pin
Heath Stewart24-Jun-04 9:47
protectorHeath Stewart24-Jun-04 9:47 
GeneralRe: Need PDF help Pin
Anonymous24-Jun-04 11:14
Anonymous24-Jun-04 11:14 
GeneralRe: Need PDF help Pin
Heath Stewart24-Jun-04 12:30
protectorHeath Stewart24-Jun-04 12:30 
GeneralRe: Need PDF help Pin
Daniel Turini24-Jun-04 11:35
Daniel Turini24-Jun-04 11:35 
GeneralPassing parameters to Contents.htm file Pin
IrishSonic24-Jun-04 9:30
IrishSonic24-Jun-04 9:30 
GeneralRe: Passing parameters to Contents.htm file Pin
Dave Kreskowiak24-Jun-04 9:41
mveDave Kreskowiak24-Jun-04 9:41 
Generalproblem Pin
RomanD24-Jun-04 9:07
RomanD24-Jun-04 9:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.