Groups | Blog | Home
all groups > vb.net controls > may 2004 >

vb.net controls : Me.Controls.Add() affecting control visibility?



Bryan Callahan
5/28/2004 9:54:32 PM
Could someone please tell me why the Controls.Add()
method sets the visibility of the control to False? Also,
how can I work around this? I would _really_ appreciate
some help on this. (The below code is: vb.net) My e-mail
is bryancallahan@charter.net thanks in advance everyone!!

Public Class TestForm
Inherits System.Windows.Forms.Form

Public Sub New()

Dim k As New Control()
MsgBox(k.Visible) 'Why does this return
True?
Me.Controls.Add(k)
k.Visible = True
MsgBox(k.Visible) 'Why does this return
False?

End Sub

rami.saad NO[at]SPAM egdsc.microsoft.com (
5/31/2004 11:03:29 AM
Hello,
I tried your code using VS.Net 2003, and it returned "True" in both cases.

Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC


AddThis Social Bookmark Button