I am creating a form and loading data into it with the intention of showing it as a dialog. The data loads but the InitializeLayout event does not fire.
If I call the .Show method on the form before loading the data, the event fires.
Am I doing something wrong?
Sorry for this post. I finally realized that while I was wiring up the event handler on a local variable that references the grid, i was initializing this local variable in the form.load event. Therefore, as long as I wasn't showing the form, the form.load event didn't fire. By the time the form.load event fired, the grid's initialized event had already fired. Only if I showed the form before binding my grid, was the local variable properly initialized at the right time.
Hello,
Have you tried Mike's suggestion? Is this working for you?
Please let us know if you have any other questions.
The event is probably optimized not to fire until the first time the grid paints. Try calling grid.Refresh() and that should force a paint.