1

I am trying to update a single motor control application into a program that controls an unknown number of motors(adding motor controls at runtime). The old application was written very statically and relied on windows form designer to generate its views. I am trying to refactor the designer code to basically just display multiple occurrences each inside a Tab Page. I am already running into errors with Windows form designer. When I try and pull the initialization of components out into their own methods I get an error:

Method 'System.Windows.Forms.Form.InitializeForceIsMaintained' not found. 

How do I tell C# I want to use the local method and not some inherited method?

I'm calling InitializeForceIsMaintained like so

private Void InitializeComponent() { this.InitializeForceIsMaintained(); } 

and

private void InitializeForceIsMaintained() { // // forceIsMaintained // this.forceIsMaintained.AutoReset = false; this.forceIsMaintained.Interval = 8000; this.forceIsMaintained.SynchronizingObject = this; this.forceIsMaintained.Elapsed += this.forceIsMaintained_Elapsed; } 
2
  • With the code presented (assuming 1 class) that error should not happen. Please show a more complete outline. Commented Apr 9, 2010 at 15:32
  • The one method you should never change yourself is InitializeComponent(). It is auto-generated by the designer. Commented Apr 9, 2010 at 16:18

2 Answers 2

1

Don't understand the complete problem, but you should never modify the designer code as its generated, so you'll only either lose your changes or break the designer.

Sign up to request clarification or add additional context in comments.

1 Comment

Excellent point: The designer code looks like C# but should never be edited or modified, because the Visual Designer parses the code in order to do the editing. It's more like a really weird serialization format that happens to also be compilable.
0

Can you inherit your objects from System.Windows.Forms.Form and then override the method in question? Then it would choose to use yours instead of the default one in the Forms.Form class.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.