Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, July 26, 2010 4:42 PM
VB.Net VS2010
I have some forms that were VS2005 forms the I moved to VS2010. The forms have a tab control and on the tabcontrol are some panel containers. If I add a multi-line textbox toa panel I'm seeing the text offset from the left margin. If I make a form from scratch the margin does not appear.
Any idea where this left margin is coming from?
Is there a way to set the left internal margin in code?
All replies (9)
Thursday, July 29, 2010 3:23 PM âś…Answered
I can't come up with a good test case to post.
The forms I've imported from VS2005 (I inncorrectly stated VS2008 ealier) are the only one's that have the problem. These forms have 50+ controls some of which are containers with controls (tabs.)
I was hoping someone recognized the problem and had an easy work around. Doesn't look like that's the case.
I'm fine with stopping the thread here. If someone wants to dig further write me: rheitzman on g mail.
Monday, July 26, 2010 5:04 PM
Hi Bob. I'm not sure if fully follow your steps, but could you be encountering the effects of the Padding property? It allows you to create offsets for children controls for any or all of the four sides of a control.
Tuesday, July 27, 2010 5:01 PM
I don't see a Padding property on my TextBoxes at design time. I'm deal with WinForms and not web controls.
Wednesday, July 28, 2010 12:23 AM
No. I'm talking about WinForms... the padding property would belong to the panel that contains the textbox. I didn't realize you were talking about spacing within the textbox - sorry for that. Plus, Padding only applies (I believe) to controls that are docked within a container.
Without more detail this is hard to diagnose. For instance, this could be as simple as having the textbox.TextAlign property be set to 'Center' and the text be smaller than the textbox itself. I'll assume you checked for that already though. It might help to post the designer code for the textbox and the containing panel. If you are unfamiliar with this go to Solution Explorer and expand Form1 (or whatever your form is named) in teh treeview. If you can't expand it then look to the top of the explorer window and click an icon that has 3 different document symbols superimposed (tootip should say "Show All Files"). Once expanded you should see Form.Designer.vb -- double click it and you'll see the designer code that VS auto-generates based upon your visual designer choices. Here's what my designer code looks like, please post yours as well:
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.Gainsboro
Me.Panel1.Controls.Add(Me.TextBox1)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel1.Location = New System.Drawing.Point(34, 34)
Me.Panel1.Margin = New System.Windows.Forms.Padding(5, 23, 23, 23)
Me.Panel1.Name = "Panel1"
Me.Panel1.Padding = New System.Windows.Forms.Padding(23)
Me.Panel1.Size = New System.Drawing.Size(340, 235)
Me.Panel1.TabIndex = 0
'
'TextBox1
'
Me.TextBox1.Dock = System.Windows.Forms.DockStyle.Left
Me.TextBox1.Location = New System.Drawing.Point(23, 23)
Me.TextBox1.Margin = New System.Windows.Forms.Padding(12)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(210, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "Hello"
Note: I have some margin and padding lines because I was playing around with the controls -- yours will likely look different.
Wednesday, July 28, 2010 8:40 PM
Here are the two textboxes. The first is a single line, the second a multiline. The text in the multi-line version has a few points left internal margin. I didn't see any other code specifc to these controls but there has to be some somewhere as I don't see a multi-line property nor any size information.
'txtOrig_Inspection_ID
'
Me.txtOrig_Inspection_ID.BackColor = System.Drawing.SystemColors.Info
Me.txtOrig_Inspection_ID.Location = New System.Drawing.Point(163, 29)
Me.txtOrig_Inspection_ID.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.txtOrig_Inspection_ID.Name = "txtOrig_Inspection_ID"
Me.txtOrig_Inspection_ID.Size = New System.Drawing.Size(117, 28)
Me.txtOrig_Inspection_ID.TabIndex = 22
Me.txtOrig_Inspection_ID.TabStop = False
Me.txtOrig_Inspection_ID.Tag = "Numeric"
'txtOrig_Inspection_ID__Reason
'
Me.txtOrig_Inspection_ID__Reason.BackColor = System.Drawing.SystemColors.Info
Me.txtOrig_Inspection_ID__Reason.Location = New System.Drawing.Point(163, 108)
Me.txtOrig_Inspection_ID__Reason.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.txtOrig_Inspection_ID__Reason.Multiline = True
Me.txtOrig_Inspection_ID__Reason.Name = "txtOrig_Inspection_ID__Reason"
Me.txtOrig_Inspection_ID__Reason.ReadOnly = True
Me.txtOrig_Inspection_ID__Reason.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtOrig_Inspection_ID__Reason.Size = New System.Drawing.Size(263, 160)
Me.txtOrig_Inspection_ID__Reason.TabIndex = 77
Me.txtOrig_Inspection_ID__Reason.TabStop = False
Me.txtOrig_Inspection_ID__Reason.Tag = ""
Me.txtOrig_Inspection_ID__Reason.Text = "XXXX"
Wednesday, July 28, 2010 8:53 PM
Here are the two textboxes. The first is a single line, the second a multiline. The text in the multi-line version has a few points left internal margin. I didn't see any other code specifc to these controls but there has to be some somewhere as I don't see a multi-line property nor any size information.
'txtOrig_Inspection_ID ' Me.txtOrig_Inspection_ID.BackColor = System.Drawing.SystemColors.Info Me.txtOrig_Inspection_ID.Location = New System.Drawing.Point(163, 29) Me.txtOrig_Inspection_ID.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) <- Padding Property Me.txtOrig_Inspection_ID.Name = "txtOrig_Inspection_ID" Me.txtOrig_Inspection_ID.Size = New System.Drawing.Size(117, 28) Me.txtOrig_Inspection_ID.TabIndex = 22 Me.txtOrig_Inspection_ID.TabStop = False Me.txtOrig_Inspection_ID.Tag = "Numeric"'txtOrig_Inspection_ID__Reason ' Me.txtOrig_Inspection_ID__Reason.BackColor = System.Drawing.SystemColors.Info Me.txtOrig_Inspection_ID__Reason.Location = New System.Drawing.Point(163, 108) Me.txtOrig_Inspection_ID__Reason.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) <- Padding Property Me.txtOrig_Inspection_ID__Reason.Multiline = True <- MultiLine Property Me.txtOrig_Inspection_ID__Reason.Name = "txtOrig_Inspection_ID__Reason" Me.txtOrig_Inspection_ID__Reason.ReadOnly = True Me.txtOrig_Inspection_ID__Reason.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.txtOrig_Inspection_ID__Reason.Size = New System.Drawing.Size(263, 160) Me.txtOrig_Inspection_ID__Reason.TabIndex = 77 Me.txtOrig_Inspection_ID__Reason.TabStop = False Me.txtOrig_Inspection_ID__Reason.Tag = "" Me.txtOrig_Inspection_ID__Reason.Text = "XXXX"
Wednesday, July 28, 2010 9:04 PM
Just quoted text appeared...
I tried using a direct paste from VS2010 with the Productivity Power Tools extension which claims to support HTML paste. I just did a direct paste into the richtext box and didn't use the wrappers.
Other than the font being too big making it hard to read is there a problem with the HTML paste?
Wednesday, July 28, 2010 9:43 PM
FYI
If I add two textboxes to a form I imported from VS2008 into VS2010 as soon as I set the Multiline property True on one of them the internal margin shows up.
If I add a new form t0 the VS10 project the internal margin problem does not show up.
So, there is somthing different about the converted forms.
I have to types of 'conversion'; one was I copied an 08 project and opened it in 10 and conversion wizard ran. I have also used Add Exisitng Item and pulled in forms created in 08. The margin problem is the same in each case.
Wednesday, July 28, 2010 11:11 PM
Hi Bob,
Would you mind posting the entire code you have so far for the following two files please?
- Form1.Vb
- Form1.Designer.Vb
Thanks.
If any of it contains date you do not want the world to see then can you change it temporarily for some fictitious data?