Placing Code - InitializeComponent Function()
-
Hi! I'm using Windows Forms C++. I've placed my code(like adding event handler and some IO&String handling) inside the
void InitializeComponent(void)
function. It's stated that not to modify this function with any code editor. Will this result in any problem in the future? If so, Where should I place my own code? Excuse me,if it is a silly Question. I've not used Windows Forms before. Can any body suggest any online material for Windows Forms as a start up? -
Hi! I'm using Windows Forms C++. I've placed my code(like adding event handler and some IO&String handling) inside the
void InitializeComponent(void)
function. It's stated that not to modify this function with any code editor. Will this result in any problem in the future? If so, Where should I place my own code? Excuse me,if it is a silly Question. I've not used Windows Forms before. Can any body suggest any online material for Windows Forms as a start up?No. I recommend placing it after the call to InitailzeComponent e.g.:
InitializeComponent(); // //TODO: Add the constructor code here // m\_CellInError = gcnew Point(-2, -2); // Needed for Error Icon on grid
You can also use Visual Studio's IDE to add a FormLoad Event for set up stuff. Code in the InitializeComponent that you add yourself risks being erased when the IDE refreshes your form
Ger
-
Hi! I'm using Windows Forms C++. I've placed my code(like adding event handler and some IO&String handling) inside the
void InitializeComponent(void)
function. It's stated that not to modify this function with any code editor. Will this result in any problem in the future? If so, Where should I place my own code? Excuse me,if it is a silly Question. I've not used Windows Forms before. Can any body suggest any online material for Windows Forms as a start up?pix_programmer wrote:
Where should I place my own code?
Anywhere you like except places marked "do not modify".
pix_programmer wrote:
Excuse me,if it is a silly Question.
So you are excused. This once. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.