06-14-2014, 02:05 PM
Join Date: Aug 2012
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.
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
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
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?