StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Generated Designer code questionsExpand / Collapse
Author
Message
Posted 07/05/2007 4:13:11 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 08/02/2007 11:33:25 AM
Posts: 26, Visits: 1,038
I have a StrataFrame form I'm working on that is similar to a standard windows form.  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.  I wanted to code some events for the controls I copied and pasted.  When I looked in the code window in the class name drop down for these label controls they didn't appear.  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 labelname as System.Windows.Forms.Label entry in the InitializeComponent sub.  I tried doing a clean build, rebuild and build solution, but the designer generated code for these controls did not change.

A label that I copied from the other form and pasted onto the new one gets these lines of code generated in the initialize component:

   Dim Label1 As System.Windows.Forms.Label
   
   Label1 = New System.Windows.Forms.Label
   
   'Label1
   '
   Label1.AutoSize = True
   Label1.Location = New System.Drawing.Point(48, 30)
   Label1.Name = "Label1"
   Label1.Size = New System.Drawing.Size(42, 13)
   Label1.TabIndex = 107
   Label1.Text = "Facility:"
   
   Me.PropertyInformationThemedPanel.Controls.Add(Label1)

while a label I created gets these lines in the initialize component:

   Me.Label21 = New System.Windows.Forms.Label
   
   Me.PropertyInformationThemedPanel.Controls.Add(Me.Label21)
   
   'Label21
   '
   Me.Label21.AutoSize = True
   Me.Label21.Location = New System.Drawing.Point(540, 11)
   Me.Label21.Name = "Label21"
   Me.Label21.Size = New System.Drawing.Size(16, 13)
   Me.Label21.TabIndex = 137
   Me.Label21.Text = "---"

plus the aforementioned WithEvents line: 

   Friend WithEvents Label21 As System.Windows.Forms.Label

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?

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?

Any advice would be greatly appreciated.

Post #9998
Posted 07/06/2007 10:07:59 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:23:29 PM
Posts: 4,887, Visits: 4,871
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?

No.  You have to "smoke-it" and add it back. (That is Texan for delete )

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?

Not really.  This is something that we end-up doing all of the time.  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!

Post #10028
Posted 07/06/2007 11:27:53 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 08/02/2007 11:33:25 AM
Posts: 26, Visits: 1,038
Thanks Trent.  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.
Post #10032
Posted 07/06/2007 1:06:38 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:23:29 PM
Posts: 4,887, Visits: 4,871
I understand...glad you asked
Post #10036
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 4:38am

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 11 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.