469,625 Members | 908 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

Controls disapear after pasting some code. WHY????

Hi Everyone.
I have been designing a form with about 100 or so controls and today I
pasted some code from another test project into this one and then all the
controls on the form disapeared from view. If I look at the
Region " Windows Form Designer generated code" section I can see the code
for the controls are there. Except for a few controls, like a tab control and
some labels (these controls are highlighted with errors). Why would this
happen, and how do I get the control back into view. This makes no since.
Thanks for any help.
Michael

Nov 23 '05 #1
10 1233
Michael wrote:
Hi Everyone.
I have been designing a form with about 100 or so controls and today I
pasted some code from another test project into this one and then all the
controls on the form disapeared from view. If I look at the
Region " Windows Form Designer generated code" section I can see the code
for the controls are there. Except for a few controls, like a tab control and
some labels (these controls are highlighted with errors). Why would this
happen, and how do I get the control back into view. This makes no since.
Thanks for any help.
Michael


Are you sure the controls aren't there and are just hidden by another
control. There is a dropdown in the property view that shows all
controls on the form. Is your controls listed in there?

Chris
Nov 23 '05 #2
Dear Michael,

Could you please tell us what code was pasted and what the errors are, you
are getting? If the controls on a form have some kind of error, these
controls will not show up. So you need to resolve these first and then (if
you are lucky) you would get the controls visible again (as now, they load
without errors).

Hope I helped you,

Michel van den Berg

"Michael" <Mi*****@discussions.microsoft.com> schreef in bericht
news:50**********************************@microsof t.com...
Hi Everyone.
I have been designing a form with about 100 or so controls and today I
pasted some code from another test project into this one and then all the
controls on the form disapeared from view. If I look at the
Region " Windows Form Designer generated code" section I can see the code
for the controls are there. Except for a few controls, like a tab control
and
some labels (these controls are highlighted with errors). Why would this
happen, and how do I get the control back into view. This makes no since.
Thanks for any help.
Michael

Nov 23 '05 #3

"I Don't Like Spam" <no@spam.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
Are you sure the controls aren't there and are just hidden by another
control. There is a dropdown in the property view that shows all
controls on the form. Is your controls listed in there?

Chris


I like to use the Document Outline window for this (finding a control on a
form).

Ctrl-Alt-T

Greg
Nov 23 '05 #4
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message news:uH**************@TK2MSFTNGP15.phx.gbl...

"I Don't Like Spam" <no@spam.com> wrote in message news:e8**************@TK2MSFTNGP12.phx.gbl...
Are you sure the controls aren't there and are just hidden by another control. There is a dropdown in the property
view that shows all
controls on the form. Is your controls listed in there?

Chris


I like to use the Document Outline window for this (finding a control on a form).

Ctrl-Alt-T


It's Ctrl-Alt-D in my IDE (VS.NET 2003)--but it
doesn't "find" any controls on any of my forms...

Nov 23 '05 #5

"Micky" <mi***@n05pam.com> wrote in message news:dlh2q2$nn7>> I like to use
the Document Outline window for this (finding a control on a form).

Ctrl-Alt-T


It's Ctrl-Alt-D in my IDE (VS.NET 2003)--but it
doesn't "find" any controls on any of my forms...


Hmm. Actually being able to search would be nice wouldn't it?

It's Ctrl-Alt-T in both 2003 & 2005 on my machine, wth both [Default
Settings] and VB6 keyboard scheme...
Nov 23 '05 #6
Hi Chris,
THanks for the reply. I had a tabcontrol with about 5 tabpages on it. After
pasting the code into the editor the tabcontrol seemed to have been removed
some how, although 4 of the 5 tabpages where still there. Most of the
controls on the missing tabpage still seem to be listed. Yesterday I took
form into another project and added the Tabcontrol and I'm slowly trying to
rebuild the form by connecting the controls to the tabpages. I'm doing this
by adding the controls back into the tabpages and form with code like this
Me.TabControl1.Controls.Add(Me.TabPage1)
This code is in the "Form Designer generated code" section. Does this help
any.
Thanks again for the reply.
Michael
"I Don't Like Spam" wrote:
Michael wrote:
Hi Everyone.
I have been designing a form with about 100 or so controls and today I
pasted some code from another test project into this one and then all the
controls on the form disapeared from view. If I look at the
Region " Windows Form Designer generated code" section I can see the code
for the controls are there. Except for a few controls, like a tab control and
some labels (these controls are highlighted with errors). Why would this
happen, and how do I get the control back into view. This makes no since.
Thanks for any help.
Michael


Are you sure the controls aren't there and are just hidden by another
control. There is a dropdown in the property view that shows all
controls on the form. Is your controls listed in there?

Chris

Nov 23 '05 #7
Hi Michel,
I pasted the code right below the " Windows Form Designer generated code"
region, and the region was closed so it should not have overwriten any of
that code. Right After pasting the code, the tabcontrol disapeared from the
form without any error messages showing. After more investigation, I found 4
of the 5 tabpages in the code (in the region above). Somehow the tabcontrol
and 1 tabpage was totally removed from the form somehow. The form has no code
except for a few other control loading (conbos & flexgrid) functions. Here is
the code I pasted into the form.
Private Sub SetHeaders()
Dim i%
' initialize control
flxFamilyHistory1.Styles.Normal.WordWrap = True
flxFamilyHistory1.Cols.Count = 6
flxFamilyHistory1.Rows.Fixed = 2
flxFamilyHistory1.AllowMerging = AllowMergingEnum.FixedOnly
' create row headers
flxFamilyHistory1.Rows(0).AllowMerging = True
' four cells, will merge
Dim rng As CellRange = flxFamilyHistory1.GetCellRange(0, 1, 0, 2)
rng.Data = "If Living"
' four cells, will merge
rng = flxFamilyHistory1.GetCellRange(0, 3, 0, 4)
rng.Data = "If Deceased"
flxFamilyHistory1(1, 1) = "Age"
flxFamilyHistory1(1, 2) = "Health"
flxFamilyHistory1(1, 3) = "Age of Death"
flxFamilyHistory1(1, 4) = "Cause of Death"
flxFamilyHistory1(1, 5) = "Who"
' create column header
flxFamilyHistory1.Cols(0).AllowMerging = True
' two cells, will merge
rng = flxFamilyHistory1.GetCellRange(0, 0, 1, 0)
rng.Data = "Person"
' align and autozise the cells
flxFamilyHistory1.Styles.Fixed.TextAlign = TextAlignEnum.CenterCenter
flxFamilyHistory1.AutoSizeCols(1, flxFamilyHistory1.Cols.Count - 2,
10)
flxFamilyHistory1.Cols(5).Width = 150
End Sub

Private Sub SetFixedColumn()
flxFamilyHistory1(2, 0) = "Father"
flxFamilyHistory1(3, 0) = "Mother"
flxFamilyHistory1(4, 0) = "Brothers"
flxFamilyHistory1(9, 0) = "Sisters"
End Sub
The form will not load right now because the VB generated code still has
references to controls that where removed/lost saying that the control is not
a member of the form. Yet it still has the code like:
Me.Label4 = New System.Windows.Forms.Label
further down in the code:
Me.TabPage1.Controls.Add(Me.Label4)
further down in the code:
Me.Label4.Location = New System.Drawing.Point(16, 339)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(176, 16)
Me.Label4.TabIndex = 5
Me.Label4.Text = "Have you ever had a transfusion?"
Does any of this make since to anyone. Thanks for the reply and suggestions.
Michael
Nov 23 '05 #8
Dear Michael,

I must admit it is very strange! To resolve this issue please tel me if I
correctly understand you:

- You had a form with many controls on it (question: are these only the
standard winform controls or 3rd party/inherited controls?)
- Next you pasted the code (as shown below = 2 subs).
- Now, suddenly, some controls are gone from your form (questions: Is your
form still drawn in the designer? Are there on this moment any errors? If
yes, then please state the errors)

Hopefully we/I can help you out (otherwise, contacting MS is suggested),

Michel van den Berg
"Michael" <Mi*****@discussions.microsoft.com> schreef in bericht
news:B7**********************************@microsof t.com...
Hi Michel,
I pasted the code right below the " Windows Form Designer generated code"
region, and the region was closed so it should not have overwriten any of
that code. Right After pasting the code, the tabcontrol disapeared from
the
form without any error messages showing. After more investigation, I found
4
of the 5 tabpages in the code (in the region above). Somehow the
tabcontrol
and 1 tabpage was totally removed from the form somehow. The form has no
code
except for a few other control loading (conbos & flexgrid) functions. Here
is
the code I pasted into the form.
Private Sub SetHeaders()
Dim i%
' initialize control
flxFamilyHistory1.Styles.Normal.WordWrap = True
flxFamilyHistory1.Cols.Count = 6
flxFamilyHistory1.Rows.Fixed = 2
flxFamilyHistory1.AllowMerging = AllowMergingEnum.FixedOnly
' create row headers
flxFamilyHistory1.Rows(0).AllowMerging = True
' four cells, will merge
Dim rng As CellRange = flxFamilyHistory1.GetCellRange(0, 1, 0, 2)
rng.Data = "If Living"
' four cells, will merge
rng = flxFamilyHistory1.GetCellRange(0, 3, 0, 4)
rng.Data = "If Deceased"
flxFamilyHistory1(1, 1) = "Age"
flxFamilyHistory1(1, 2) = "Health"
flxFamilyHistory1(1, 3) = "Age of Death"
flxFamilyHistory1(1, 4) = "Cause of Death"
flxFamilyHistory1(1, 5) = "Who"
' create column header
flxFamilyHistory1.Cols(0).AllowMerging = True
' two cells, will merge
rng = flxFamilyHistory1.GetCellRange(0, 0, 1, 0)
rng.Data = "Person"
' align and autozise the cells
flxFamilyHistory1.Styles.Fixed.TextAlign =
TextAlignEnum.CenterCenter
flxFamilyHistory1.AutoSizeCols(1, flxFamilyHistory1.Cols.Count - 2,
10)
flxFamilyHistory1.Cols(5).Width = 150
End Sub

Private Sub SetFixedColumn()
flxFamilyHistory1(2, 0) = "Father"
flxFamilyHistory1(3, 0) = "Mother"
flxFamilyHistory1(4, 0) = "Brothers"
flxFamilyHistory1(9, 0) = "Sisters"
End Sub
The form will not load right now because the VB generated code still has
references to controls that where removed/lost saying that the control is
not
a member of the form. Yet it still has the code like:
Me.Label4 = New System.Windows.Forms.Label
further down in the code:
Me.TabPage1.Controls.Add(Me.Label4)
further down in the code:
Me.Label4.Location = New System.Drawing.Point(16, 339)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(176, 16)
Me.Label4.TabIndex = 5
Me.Label4.Text = "Have you ever had a transfusion?"
Does any of this make since to anyone. Thanks for the reply and
suggestions.
Michael

Nov 23 '05 #9
Hi Michel,
The form itself does show in the designer just fine (but no controls show).
I do have 2 Componentone Flaxgrids on the form. All other controls are
standard controls.
There are alot of " 'controlname' is not a member of FormName" errors, but
thats it. Did not have these before the code was pasted to the form.
I'm in the process of fixing it. I do have the tabcontrol back in a test
project. I had to add the control to the form, then I went into the Desiner
generated code and added/fixed the code that loads the tabcontrol and
tabpages. I'm hoping this does not happen again as this can be very time
consuming. This time it lost track of about 20 or so controls. Thanks again
for your time.
Michael

"Michel van den Berg" wrote:
Dear Michael,

I must admit it is very strange! To resolve this issue please tel me if I
correctly understand you:

- You had a form with many controls on it (question: are these only the
standard winform controls or 3rd party/inherited controls?)
- Next you pasted the code (as shown below = 2 subs).
- Now, suddenly, some controls are gone from your form (questions: Is your
form still drawn in the designer? Are there on this moment any errors? If
yes, then please state the errors)

Hopefully we/I can help you out (otherwise, contacting MS is suggested),

Michel van den Berg
"Michael" <Mi*****@discussions.microsoft.com> schreef in bericht
news:B7**********************************@microsof t.com...
Hi Michel,
I pasted the code right below the " Windows Form Designer generated code"
region, and the region was closed so it should not have overwriten any of
that code. Right After pasting the code, the tabcontrol disapeared from
the
form without any error messages showing. After more investigation, I found
4
of the 5 tabpages in the code (in the region above). Somehow the
tabcontrol
and 1 tabpage was totally removed from the form somehow. The form has no
code
except for a few other control loading (conbos & flexgrid) functions. Here
is
the code I pasted into the form.
Private Sub SetHeaders()
Dim i%
' initialize control
flxFamilyHistory1.Styles.Normal.WordWrap = True
flxFamilyHistory1.Cols.Count = 6
flxFamilyHistory1.Rows.Fixed = 2
flxFamilyHistory1.AllowMerging = AllowMergingEnum.FixedOnly
' create row headers
flxFamilyHistory1.Rows(0).AllowMerging = True
' four cells, will merge
Dim rng As CellRange = flxFamilyHistory1.GetCellRange(0, 1, 0, 2)
rng.Data = "If Living"
' four cells, will merge
rng = flxFamilyHistory1.GetCellRange(0, 3, 0, 4)
rng.Data = "If Deceased"
flxFamilyHistory1(1, 1) = "Age"
flxFamilyHistory1(1, 2) = "Health"
flxFamilyHistory1(1, 3) = "Age of Death"
flxFamilyHistory1(1, 4) = "Cause of Death"
flxFamilyHistory1(1, 5) = "Who"
' create column header
flxFamilyHistory1.Cols(0).AllowMerging = True
' two cells, will merge
rng = flxFamilyHistory1.GetCellRange(0, 0, 1, 0)
rng.Data = "Person"
' align and autozise the cells
flxFamilyHistory1.Styles.Fixed.TextAlign =
TextAlignEnum.CenterCenter
flxFamilyHistory1.AutoSizeCols(1, flxFamilyHistory1.Cols.Count - 2,
10)
flxFamilyHistory1.Cols(5).Width = 150
End Sub

Private Sub SetFixedColumn()
flxFamilyHistory1(2, 0) = "Father"
flxFamilyHistory1(3, 0) = "Mother"
flxFamilyHistory1(4, 0) = "Brothers"
flxFamilyHistory1(9, 0) = "Sisters"
End Sub
The form will not load right now because the VB generated code still has
references to controls that where removed/lost saying that the control is
not
a member of the form. Yet it still has the code like:
Me.Label4 = New System.Windows.Forms.Label
further down in the code:
Me.TabPage1.Controls.Add(Me.Label4)
further down in the code:
Me.Label4.Location = New System.Drawing.Point(16, 339)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(176, 16)
Me.Label4.TabIndex = 5
Me.Label4.Text = "Have you ever had a transfusion?"
Does any of this make since to anyone. Thanks for the reply and
suggestions.
Michael


Nov 23 '05 #10
Dear Michael,

Thank you for giving the information. I must honestly say I don't know what
it can be, but I do recommend you, if you have the time that is, to
communicate with MS itself. Hopefully, this can be resolved as a bug and be
fixed.

Sorry that I couldn't help more,

Michel van den Berg

--
== Remove nospam to email me ==
"Michael" <Mi*****@discussions.microsoft.com> schreef in bericht
news:1F**********************************@microsof t.com...
Hi Michel,
The form itself does show in the designer just fine (but no controls
show).
I do have 2 Componentone Flaxgrids on the form. All other controls are
standard controls.
There are alot of " 'controlname' is not a member of FormName" errors, but
thats it. Did not have these before the code was pasted to the form.
I'm in the process of fixing it. I do have the tabcontrol back in a test
project. I had to add the control to the form, then I went into the
Desiner
generated code and added/fixed the code that loads the tabcontrol and
tabpages. I'm hoping this does not happen again as this can be very time
consuming. This time it lost track of about 20 or so controls. Thanks
again
for your time.
Michael

"Michel van den Berg" wrote:
Dear Michael,

I must admit it is very strange! To resolve this issue please tel me if I
correctly understand you:

- You had a form with many controls on it (question: are these only the
standard winform controls or 3rd party/inherited controls?)
- Next you pasted the code (as shown below = 2 subs).
- Now, suddenly, some controls are gone from your form (questions: Is
your
form still drawn in the designer? Are there on this moment any errors? If
yes, then please state the errors)

Hopefully we/I can help you out (otherwise, contacting MS is suggested),

Michel van den Berg
"Michael" <Mi*****@discussions.microsoft.com> schreef in bericht
news:B7**********************************@microsof t.com...
> Hi Michel,
> I pasted the code right below the " Windows Form Designer generated
> code"
> region, and the region was closed so it should not have overwriten any
> of
> that code. Right After pasting the code, the tabcontrol disapeared from
> the
> form without any error messages showing. After more investigation, I
> found
> 4
> of the 5 tabpages in the code (in the region above). Somehow the
> tabcontrol
> and 1 tabpage was totally removed from the form somehow. The form has
> no
> code
> except for a few other control loading (conbos & flexgrid) functions.
> Here
> is
> the code I pasted into the form.
> Private Sub SetHeaders()
> Dim i%
> ' initialize control
> flxFamilyHistory1.Styles.Normal.WordWrap = True
> flxFamilyHistory1.Cols.Count = 6
> flxFamilyHistory1.Rows.Fixed = 2
> flxFamilyHistory1.AllowMerging = AllowMergingEnum.FixedOnly
> ' create row headers
> flxFamilyHistory1.Rows(0).AllowMerging = True
> ' four cells, will merge
> Dim rng As CellRange = flxFamilyHistory1.GetCellRange(0, 1, 0,
> 2)
> rng.Data = "If Living"
> ' four cells, will merge
> rng = flxFamilyHistory1.GetCellRange(0, 3, 0, 4)
> rng.Data = "If Deceased"
> flxFamilyHistory1(1, 1) = "Age"
> flxFamilyHistory1(1, 2) = "Health"
> flxFamilyHistory1(1, 3) = "Age of Death"
> flxFamilyHistory1(1, 4) = "Cause of Death"
> flxFamilyHistory1(1, 5) = "Who"
> ' create column header
> flxFamilyHistory1.Cols(0).AllowMerging = True
> ' two cells, will merge
> rng = flxFamilyHistory1.GetCellRange(0, 0, 1, 0)
> rng.Data = "Person"
> ' align and autozise the cells
> flxFamilyHistory1.Styles.Fixed.TextAlign =
> TextAlignEnum.CenterCenter
> flxFamilyHistory1.AutoSizeCols(1, flxFamilyHistory1.Cols.Count -
> 2,
> 10)
> flxFamilyHistory1.Cols(5).Width = 150
> End Sub
>
> Private Sub SetFixedColumn()
> flxFamilyHistory1(2, 0) = "Father"
> flxFamilyHistory1(3, 0) = "Mother"
> flxFamilyHistory1(4, 0) = "Brothers"
> flxFamilyHistory1(9, 0) = "Sisters"
> End Sub
> The form will not load right now because the VB generated code still
> has
> references to controls that where removed/lost saying that the control
> is
> not
> a member of the form. Yet it still has the code like:
> Me.Label4 = New System.Windows.Forms.Label
> further down in the code:
> Me.TabPage1.Controls.Add(Me.Label4)
> further down in the code:
> Me.Label4.Location = New System.Drawing.Point(16, 339)
> Me.Label4.Name = "Label4"
> Me.Label4.Size = New System.Drawing.Size(176, 16)
> Me.Label4.TabIndex = 5
> Me.Label4.Text = "Have you ever had a transfusion?"
> Does any of this make since to anyone. Thanks for the reply and
> suggestions.
> Michael
>
>


Nov 23 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Chris Thunell | last post: by
7 posts views Thread by Dragon | last post: by
2 posts views Thread by Rob R. Ainscough | last post: by
reply views Thread by Michael | last post: by
2 posts views Thread by mark.bergman | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.