Error Creating Window Handle

Posted: 1/9/2008 3:48:59 PM

So I was getting this real sweet "Error Creating Window Handle" exception in one of my apps when I went to ".Show()" a window in the app (not during the form's construction". I found that if I commented out attaching a DataSource to the a combobox, showing the form worked fine. After reading a lot about window handles and GDI objects and getting no where, lots of trial and error commenced. Apparently Combobox does not like having the "DisplayMember" property set after the datasource is set, but only if one of the objects in the datasource has null for its DisplayMember property. (The DisplayMember was a property called "Name", if one of the objects had null for its "Name" property, it blows up). But apparently if you set the DisplayMember BEFORE you set your datasource, it is ok to have a displaymember prop be null. Oy veh.