3 Replies - 8227 Views - Last Post: 05 May 2012 - 10:00 AM

#1 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Designer Requires Data Not Available Until Runtime

Posted 05 May 2012 - 08:05 AM

I want to implement a Settings class for my application, which is loaded from an .xml file before my Form is initialized. Among other things it will change the way in which the form is displayed. What didn't occur to me immediately was that I wouldn't have access to those settings at design time, and that I would be unable to use drag and drop features in such a state.

I'm sure this kind of situation has been dealt with many times, so I wanted to get some input. Should I just let the form initialize and then modify all the settings, should I ignore losing the drag and drop features and continue as planned (which I'd prefer not to do), or is there some kind of workaround that lets me do both?

If it matters, I'm working in C#.

This post has been edited by Ntwiles: 05 May 2012 - 08:05 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Designer Requires Data Not Available Until Runtime

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4332
  • View blog
  • Posts: 12,127
  • Joined: 18-April 07

Re: Designer Requires Data Not Available Until Runtime

Posted 05 May 2012 - 09:47 AM

Well what is in the settings? Are they settings for how the form is to be initialized or are you just altering the look of controls etc? 99% of the time you usually let the form initialize as normal and then implement any settings.

However, there might be a reason to alter the initialization of a form but then you have to take control of making sure that the .NET framework has all it needs to render the form correctly to screen.

So it depends on what you are trying to accomplish and if you can delay the configuration after the form has initialized.

:)
Was This Post Helpful? 1
  • +
  • -

#3 darek9576  Icon User is online

  • D.I.C Lover

Reputation: 198
  • Posts: 1,688
  • Joined: 13-March 10

Re: Designer Requires Data Not Available Until Runtime

Posted 05 May 2012 - 09:54 AM

You could create a form by hand writing the code. So if the settings specify controls that are to appear, loop through them, give them some nice layout and set visible.
Was This Post Helpful? 0
  • +
  • -

#4 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Designer Requires Data Not Available Until Runtime

Posted 05 May 2012 - 10:00 AM

So far the only setting I've implemented is just to alter the look of the controls; it changes the form's BackColor property. I don't have any specific plans to mess with the form's initialization. I just thought it seemed counter-intuitive to mess with the attributes of the form after the fact when I have access to all the information before it's loaded. I'm sure I'll fall squarely into that 99% though, thanks for the response!

This post has been edited by Ntwiles: 05 May 2012 - 10:01 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1