Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move Event for Parent Form

Tags:

c#

winforms

I'm working on adding some functionality and fixing some bugs in this code I found here: http://www.c-sharpcorner.com/uploadfile/a644fc/multicolumn-combobox-with-configurable-display-and-value-members-and-fast-search-functionality/

One issue is that the grid attached to the textbox stays in the same position on the screen when you move the window. I'm trying to fix this by hiding the grid whenever the parent form is moved. In the MultiColumnComboBox class file, I'm using this line of code

 this.Parent.Move += new System.EventHandler(this.parent_Move); 

to add my function, parent_Move in the parent's move event. The issue is that Parent is always null. Is there any way to add to the parent's move event from the class file? Or is there any other way to determine if the parent form's screen location changed? I'm planning on using this control a lot and would prefer to find a way to fix the issue in the class rather than in each file where I would call it. Thank you guys for any help you can give me.

like image 956
gdawgrancid Avatar asked Nov 12 '22 14:11

gdawgrancid


1 Answers

If this.Parent is always null, perhaps this answer would be of help to you: Get access to parent control from user control - C#

like image 105
Nyuno Avatar answered Nov 15 '22 04:11

Nyuno