Panel inside panel not working
Panel inside panel not working
Panel inside panel not working
Panel inside panel not working
Panel inside panel not working
Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working
Panel inside panel not working Panel inside panel not working
Panel inside panel not working
Go Back  Xtreme Visual Basic Talk > > > Panel inside panel not working


Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2014, 02:05 PM
Rabastan Rabastan is offline
Newcomer
 
Join Date: Aug 2012
Posts: 3
Default Panel inside panel not working


I am attempting to create multiple panels inside a main panel that will open (or become visible) as a "continue" button is pressed on each panel. Its just a simple program I am creating to try and learn VB. Here is what I have so far.

Code:
Public Class frmMain

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        Dim pnlMain As New Panel()
        pnlMain.Location = New System.Drawing.Point(12, 140)
        pnlMain.Name = "pnlMain"
        pnlMain.Size = New System.Drawing.Size(650, 580)
        pnlMain.BackColor = Color.White
        pnlMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Dim pnlStep1 As New Panel()
        pnlStep1.Location = New System.Drawing.Point(3, 3)
        pnlStep1.Name = "pnlTab1"
        pnlStep1.Size = New System.Drawing.Size(644, 100)
        pnlStep1.BackColor = Color.WhiteSmoke
        pnlStep1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Me.Controls.Add(pnlMain)
        Me.pnlMain.Controls.Add(pnlStep1)


        Dim pnlSub As New Panel()
        pnlSub.Location = New System.Drawing.Point(668, 140)
        pnlSub.Name = "pnlMain"
        pnlSub.Size = New System.Drawing.Size(328, 580)
        pnlSub.BackColor = Color.White
        pnlSub.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Me.Controls.Add(pnlSub)
    End Sub

End Class
I am creating two panels a main one and a smaller one to the right (to be used later). I have placed another panel within the main panel for "Step 1".

The problem I am having is at "Me.pnlMain.Controls.Add(pnlStep1)" 'pnlMain" is not a member of Just_Learning.frmMain".

What am I doing wrong?

Rab
Reply With Quote
  #2  
Old 06-15-2014, 07:41 AM
PlausiblyDamp's Avatar
PlausiblyDampPanel inside panel not working PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,056
Default

When you prefix a variable with Me you are telling VB to refer to a variable declared at the class level i.e. outside of an individual method. pnlMain is defined within the Load event though and not at the class level.

If you remove the Me from the front of that line it should work.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Panel inside panel not working
Panel inside panel not working
Panel inside panel not working Panel inside panel not working
Panel inside panel not working
Panel inside panel not working
Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working Panel inside panel not working
Panel inside panel not working
Panel inside panel not working
 
Panel inside panel not working
Panel inside panel not working
 
-->