Bug in VB.Net or am I doing something wrong? *sigh* 
Author Message
 Bug in VB.Net or am I doing something wrong? *sigh*

Hi,

I'm trying to inherit the Label, but VB.Net is messing up.

Here's what I do to reproduce the problem:

1) Create a new VB.Net project

2) Create a class/component (MyLabel) with this code:

     Inherits System.Windows.Forms.Label

     Public Sub New()
         MyBase.New()
         Me.BackColor = System.Drawing.Color.Transparent
         Me.FlatStyle = System.Windows.Forms.FlatStyle.Standard
     End Sub

3) Build the project

4) Save the project

5) Put a label (Label1) on Form1

6) in the "Windows Form Designer generated code", change ...

     Friend WithEvents Label1 As System.Windows.Forms.Label
     Me.Label1 = New System.Windows.Forms.Label()

     With...

     Friend WithEvents Label1 As MyLabel
     Me.Label1 = MyLabel()

7) Remove the...

     Me.Label1.FlatStyle = System.Windows.Forms.FlatStyle.System

8) Goto to design mode. The Label is now FlatStyle=System even though
    I've set it to be Standard.

9) Change Label1 - FlatStyle=Standard & BackColor=Transparent

10) Save the project

11) Double-click the form to generate the Form1_Load sub.

12) In the Form1_Load event make a couple of spaces and then goto Design
     view.

     Now you get this error...

     This control does not support transparent background colors.

     ...and FlatStyle is now set to System again! Damned!

13) I change FlatStyle to Standard and saves the project

14) Change to code view and delete the Form1_Load sub.

15) Click design view and now FlatStyle is back to System.

What the h... is going on here?

Is it yet another bug or am I doing something wrong?

Thank you!!!

M O J O



Fri, 27 May 2005 21:24:19 GMT  
 Bug in VB.Net or am I doing something wrong? *sigh*
Hi!

I tried a number of different ways but could not reproduce this problem. two
things - the first is that in step 6 the lines of code are:

Me.Label1 = New MyLabel   'added new

And second, i could never get step 7 because the flat style was not in code.
Maybe there is a step missing?

Chris
Microsoft VB Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.

___


Quote:
> Hi,

> I'm trying to inherit the Label, but VB.Net is messing up.

> Here's what I do to reproduce the problem:

> 1) Create a new VB.Net project

> 2) Create a class/component (MyLabel) with this code:

>      Inherits System.Windows.Forms.Label

>      Public Sub New()
>          MyBase.New()
>          Me.BackColor = System.Drawing.Color.Transparent
>          Me.FlatStyle = System.Windows.Forms.FlatStyle.Standard
>      End Sub

> 3) Build the project

> 4) Save the project

> 5) Put a label (Label1) on Form1

> 6) in the "Windows Form Designer generated code", change ...

>      Friend WithEvents Label1 As System.Windows.Forms.Label
>      Me.Label1 = New System.Windows.Forms.Label()

>      With...

>      Friend WithEvents Label1 As MyLabel
>      Me.Label1 = MyLabel()

> 7) Remove the...

>      Me.Label1.FlatStyle = System.Windows.Forms.FlatStyle.System

> 8) Goto to design mode. The Label is now FlatStyle=System even though
>     I've set it to be Standard.

> 9) Change Label1 - FlatStyle=Standard & BackColor=Transparent

> 10) Save the project

> 11) Double-click the form to generate the Form1_Load sub.

> 12) In the Form1_Load event make a couple of spaces and then goto Design
>      view.

>      Now you get this error...

>      This control does not support transparent background colors.

>      ...and FlatStyle is now set to System again! Damned!

> 13) I change FlatStyle to Standard and saves the project

> 14) Change to code view and delete the Form1_Load sub.

> 15) Click design view and now FlatStyle is back to System.

> What the h... is going on here?

> Is it yet another bug or am I doing something wrong?

> Thank you!!!

> M O J O



Wed, 01 Jun 2005 05:32:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Am I doing something wrong ?

2. Am I doing something wrong...??

3. Am I doing something wrong...??

4. Obviously I'm doing something wrong!

5. I must be doing something wrong here

6. form class bug, or am I doing something wrong?

7. Is this a bug or am I doing something wrong?

8. BUG??? or am I doing something wrong...

9. BUG??? or am I doing something wrong...

10. Am I Doing Something Wrong, Is It A Bug, Or An Undocumented Feature?

11. Recordset: What am I doing wrong?

12. What am I doing wrong??

 

 
Powered by phpBB® Forum Software