Hi,
I'm using VS 2005 in a VB.Net WinForms application. I have a custom User Control that requires a variable to render its data correctly. My question is, what's the best way to require the calling sub to populate the variable? I've thought of a couple of options:
Have a WriteOnly property and check to see if it is "Nothing" when the User Control is loaded and throw an exception if this is the case. I don't like this because the error would be at runtime and I would like to require the variable to be populated at design time (like passing parameters to a sub/function).
Have a global variable to hold the variable that I want the User Control to use. I could also use the exception with this technique too, but, like the option I stated above, the error would be thrown at runtime.
What are your suggestions for populating the required variable that the User Control needs at design time?
Thanks in advance.