﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » Generated Designer code questions</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 07 Apr 2026 12:34:33 GMT</lastBuildDate><ttl>20</ttl><item><title>Generated Designer code questions</title><link>http://forum.strataframe.net/FindPost9998.aspx</link><description>I have a StrataFrame form I'm working on that is similar to a standard windows form.&amp;nbsp; I copied all of the labels from the original windows form and pasted them onto the StrataFrame form and then dropped new StrataFrame controls where needed.&amp;nbsp; I wanted to code some events for the controls I copied and pasted.&amp;nbsp; When I looked in the code window in the class name drop down for these label controls they didn't appear.&amp;nbsp; Upon reviewing the form.designer.vb code for this form, I noticed that none of these labels have a Friend WithEvents entry, and all of them have a dim [i]labelname[/i] as System.Windows.Forms.Label entry in the InitializeComponent sub.&amp;nbsp; I tried doing a clean build, rebuild and build solution, but the designer generated code for these controls did not change.&lt;P&gt;A label that I copied from the other form and pasted onto the new one gets these lines of code generated&amp;nbsp;in the initialize component:&lt;/P&gt;&lt;P&gt;[codesnippet]&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim Label1 As System.Windows.Forms.Label&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1 = New System.Windows.Forms.Label&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Label1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;'&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1.AutoSize = True&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1.Location = New System.Drawing.Point(48, 30)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1.Name = "Label1"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1.Size = New System.Drawing.Size(42, 13)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1.TabIndex = 107&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label1.Text = "Facility:"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.PropertyInformationThemedPanel.Controls.Add(Label1)&lt;/P&gt;&lt;P&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;while a label I created gets these lines in the initialize component:&lt;/P&gt;&lt;P&gt;[codesnippet]&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21 = New System.Windows.Forms.Label&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.PropertyInformationThemedPanel.Controls.Add(Me.Label21)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Label21&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;'&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21.AutoSize = True&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21.Location = New System.Drawing.Point(540, 11)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21.Name = "Label21"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21.Size = New System.Drawing.Size(16, 13)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21.TabIndex = 137&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.Label21.Text = "---"[/codesnippet]&lt;/P&gt;&lt;P&gt;plus the aforementioned WithEvents line:&amp;nbsp; [codesnippet]&amp;nbsp;&amp;nbsp;&amp;nbsp;Friend WithEvents Label21 As System.Windows.Forms.Label[/codesnippet]&lt;/P&gt;&lt;P&gt;1. Is there a way to force the generated code to update short of deleting all of the labels I copied and pasted and recreating them within the new form?&lt;/P&gt;&lt;P&gt;2. What are the potential negatives if I were to modify the designer code myself so that the controls I copied and pasted are coded in the designer.vb file the same way as the one I created that was new?&lt;/P&gt;&lt;P&gt;Any advice would be greatly appreciated.</description><pubDate>Fri, 06 Jul 2007 13:06:38 GMT</pubDate><dc:creator>Michael Cobb</dc:creator></item><item><title>RE: Generated Designer code questions</title><link>http://forum.strataframe.net/FindPost10036.aspx</link><description>I understand...glad you asked :)</description><pubDate>Fri, 06 Jul 2007 13:06:38 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Generated Designer code questions</title><link>http://forum.strataframe.net/FindPost10032.aspx</link><description>Thanks Trent.&amp;nbsp; I suspected it would be ok to manually modify the designer code but didn't want to waste time doing so if others hadn't blazed the trail before me without problems. ;)</description><pubDate>Fri, 06 Jul 2007 11:27:53 GMT</pubDate><dc:creator>Michael Cobb</dc:creator></item><item><title>RE: Generated Designer code questions</title><link>http://forum.strataframe.net/FindPost10028.aspx</link><description>[quote]1. Is there a way to force the generated code to update short of deleting all of the labels I copied and pasted and recreating them within the new form?[/quote]&lt;/P&gt;&lt;P&gt;No.&amp;nbsp; You have to "smoke-it" and add it back. (That is Texan for delete :D)&lt;/P&gt;&lt;P&gt;[quote]2. What are the potential negatives if I were to modify the designer code myself so that the controls I copied and pasted are coded in the designer.vb file the same way as the one I created that was new?[/quote]&lt;/P&gt;&lt;P&gt;Not really.&amp;nbsp; This is something that we end-up doing all of the time.&amp;nbsp; The properties may be reserialized once modified through the designer, but if you have enough understanding of how the InitializeComponent of the form works (which you do it sounds like) then go for it!</description><pubDate>Fri, 06 Jul 2007 10:07:59 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>