How to turn off executing Load event at design time feature?
-
I try to write a class that extends Form like that:
public partial class BaseForm : Form { public BaseForm() { InitializeComponent(); } private void BaseForm_Load(object sender, System.EventArgs e) { MessageBox.Show("Hello, World!"); } }
And then I write a class that extends class BaseFormpublic partial class MyForm : BaseForm { public MyForm() { InitializeComponent(); } }
I rebuild project and open MyForm to design, it suddenly appears "Hello, World!" message box. I think it is a stupid feature in VS 2005 (I didn't check it in VS 2002, 2003 yet). How can I turn off this feature? http://t800t8.blogspot.com/2006/02/thc-thi-s-kin-load-khi-ang-design-form.html I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing -- modified at 19:58 Monday 20th February, 2006 -
I try to write a class that extends Form like that:
public partial class BaseForm : Form { public BaseForm() { InitializeComponent(); } private void BaseForm_Load(object sender, System.EventArgs e) { MessageBox.Show("Hello, World!"); } }
And then I write a class that extends class BaseFormpublic partial class MyForm : BaseForm { public MyForm() { InitializeComponent(); } }
I rebuild project and open MyForm to design, it suddenly appears "Hello, World!" message box. I think it is a stupid feature in VS 2005 (I didn't check it in VS 2002, 2003 yet). How can I turn off this feature? http://t800t8.blogspot.com/2006/02/thc-thi-s-kin-load-khi-ang-design-form.html I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing -- modified at 19:58 Monday 20th February, 2006private void BaseForm_Load(object sender, System.EventArgs e){
protected override void OnLoad(System.EventArgs e){
if (!base.DesignMode[^]){
MessageBox.Show("Hello, World!");
}
}
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.." -- Mark McCormick
|| Fold With Us! || Pensieve || VG.Net || -- modified at 20:20 Monday 20th February, 2006
-
private void BaseForm_Load(object sender, System.EventArgs e){
protected override void OnLoad(System.EventArgs e){
if (!base.DesignMode[^]){
MessageBox.Show("Hello, World!");
}
}
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.." -- Mark McCormick
|| Fold With Us! || Pensieve || VG.Net || -- modified at 20:20 Monday 20th February, 2006
-
I try to write a class that extends Form like that:
public partial class BaseForm : Form { public BaseForm() { InitializeComponent(); } private void BaseForm_Load(object sender, System.EventArgs e) { MessageBox.Show("Hello, World!"); } }
And then I write a class that extends class BaseFormpublic partial class MyForm : BaseForm { public MyForm() { InitializeComponent(); } }
I rebuild project and open MyForm to design, it suddenly appears "Hello, World!" message box. I think it is a stupid feature in VS 2005 (I didn't check it in VS 2002, 2003 yet). How can I turn off this feature? http://t800t8.blogspot.com/2006/02/thc-thi-s-kin-load-khi-ang-design-form.html I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing -- modified at 19:58 Monday 20th February, 2006You think this is a stupid feature? How do you think controls work when you drop them on your form? There's nothing that magically renders them at design time without running the code that's in them. You MUST run code in the controls in order to see them on the form! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You think this is a stupid feature? How do you think controls work when you drop them on your form? There's nothing that magically renders them at design time without running the code that's in them. You MUST run code in the controls in order to see them on the form! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Render? Did you forget InitializeComponent() method in constructor? I just have some questions for you. + Do you like it shows a message like in my example at design time? + Do you like to get an error message and can not design your form when you only want to load the picture at runtime like this button1.Image = Image.FromFile(Constant.IMAGES_DIRECTORY_PATH + "Back.jpg"); ? These only some simple cases. If you like them, this stupid feature is for you! I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing
-
Render? Did you forget InitializeComponent() method in constructor? I just have some questions for you. + Do you like it shows a message like in my example at design time? + Do you like to get an error message and can not design your form when you only want to load the picture at runtime like this button1.Image = Image.FromFile(Constant.IMAGES_DIRECTORY_PATH + "Back.jpg"); ? These only some simple cases. If you like them, this stupid feature is for you! I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing
-
Render? Did you forget InitializeComponent() method in constructor? I just have some questions for you. + Do you like it shows a message like in my example at design time? + Do you like to get an error message and can not design your form when you only want to load the picture at runtime like this button1.Image = Image.FromFile(Constant.IMAGES_DIRECTORY_PATH + "Back.jpg"); ? These only some simple cases. If you like them, this stupid feature is for you! I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing
If you code your components correctly, this isn't a problem! Yes, I've written many of my own components, and yes, this "stupid feature" as you call it, is what made developing these components remarkably easy. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
If you code your components correctly, this isn't a problem! Yes, I've written many of my own components, and yes, this "stupid feature" as you call it, is what made developing these components remarkably easy. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Can you show me the correct way to write a component? I want to see if it is correct or not. ;-) I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing
Funny! What do you think we've been trying to tell you!? Why is it so hard to accept that when you drop a component on a form, the code in it runs at design time?! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Funny! What do you think we've been trying to tell you!? Why is it so hard to accept that when you drop a component on a form, the code in it runs at design time?! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
I told you the reason why I think this feature is stupid. But you, nothing. I just want to give you an opportunity to defend your idea. And if you cannot defend it, I will keep my idea until I find it fail. Don't wasting my time! ;-) I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing
-
I told you the reason why I think this feature is stupid. But you, nothing. I just want to give you an opportunity to defend your idea. And if you cannot defend it, I will keep my idea until I find it fail. Don't wasting my time! ;-) I'm ... a fan of Manchester United a fan of Ozzy Osbourne a King of Nothing
I don't have to! Just try and develop a control without that functionality! Of course, you can't turn it off, so, you'll just have to imagine that when you drop your control on a form to test it, nothing happens! You get a nice black hole where your control should paint itself. Why? Your rendering code doesn't run until you hit F5. You try changing a couple of properties to see if the rendering code is OK or see what the affects are, and nothing happens, until you hit F5. What a pain... It makes developing controls much easier to write and debug. If your skills can't handle that, well, ... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome