Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42732

Simple C# Question

$
0
0
Why doesn't this work? the panel does not show. It really should, it does if i add the panel from the Designer..

Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace iPhone_Clone
{
    public partial class HomeScreen : Form
    {
        public HomeScreen()
        {
            InitializeComponent();
        }
        Panel Panel = new Panel();
        PictureBox PicBox = new PictureBox();

        private void HomeScreen_Load(object sender, EventArgs e)
        {
            Panel.BackColor = Color.Green;
            Panel.Width = 50;
            Panel.Height = 100;
            Panel.Top = 50;
            Panel.Left = 50;

            PicBox.BackColor = Color.Red;

            Panel.Controls.Add(PicBox);

            Panel.Visible = true;

        }

       

    }
}


Viewing all articles
Browse latest Browse all 42732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>