-
Dec 25th, 2021, 04:35 AM
#1
Thread Starter
New Member
User Control, Visual Studio 2019
Hi,
Got a few issues as a beginner:
Using Visual Studio 2019 Windows Form
I created a windows form added a couple of buttons text boxes etc, than I added User control, played with some buttons in there, inserted to Form 1, coded to show user control on a click event from form 1, all good.
Than I went add-> new item -> user control , and for some reason the new usercontrol2 has buttons and all the other stuff usercontrol1 has. Nothing in usercontrol2 can be deleted as they belong to usercontrol1. Watched a couple of Youtube videos and no one experiences this. Any help ?
All thanks
-
Dec 25th, 2021, 08:12 AM
#2
Re: User Control, Visual Studio 2019
It looks as though your new user control is inheriting from usercontrol1, if you check the code behind it might have an Inherits statement. Worth looking to see what it says.
-
Dec 25th, 2021, 11:14 AM
#3
Thread Starter
New Member
Re: User Control, Visual Studio 2019
 Originally Posted by PlausiblyDamp
It looks as though your new user control is inheriting from usercontrol1, if you check the code behind it might have an Inherits statement. Worth looking to see what it says.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
--------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class UserControl : System.Windows.Forms.UserControl
{
public UserControl()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void UserControl_Load(object sender, EventArgs e)
{
}
}
}
-
Dec 25th, 2021, 04:40 PM
#4
Thread Starter
New Member
Re: User Control, Visual Studio 2019
Solved .... I don t know what was it ... i entirely deleted user control 1 and 2 , created them from scratch again and is not happening anymore ... so bad it will be a mystery i might fight again one day ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|