Jerry,
I think that perhaps you are confusing the property returning a null value (of type DataColumn), and the property losing its assignment. If the data contained in the object that the property is bound to is null, evaluating the property should return (DataColumn)null.
>I have a custom TextBox control that derives from TextBox. In it I have property for DataColumn and DataView. The DataView property works fine, but my property DataColumnp of type DataColumn for some reason says it is null, even if I set it during design time.
>
>I can drop my custom TextBox control, called DMHControl on the form, then look at the property window, and select a column next to the DataColumnp property during design time. I can see a + sign show up after I select the column. I can expand it and see details for the column, but suspiciously, the name does not appear next to the property, but the + sign *does* show up, so it appears set.
>
>The problem appears during execution. I have a DataBind method that I call when the form is created. In DataBind it accesses the DataColumnp (of type DataColumn as show in code fragment in my prior reply), but it throws a null exception. In the watch window I can tel that DataColumnp or for that matter my private variable _dc is null!
>
>I'm stumped because I am no code that assigns anything to this property except for the public accessors (get and set)in the Property code. Again, I showed this code in my previous post.
>
>I fear there is a bug and the column isn't actually set at design time, but I am at a loss on how to change the code to work, because I've been able to get any othe Property working as a component, by simply making it public and putting in the proper get and set code.
>
>Thanks for your help!
>
>-Jerry
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement