✅ Help?

So my code here anything with a self-reference it deletes itself. I don't know why.
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
Titlebar = new Panel();
ButtonMinimize = new Button();
ButtonExit = new Button();
Title = new Label();
TitlebarIcon = new PictureBox();
TitlebarAccent = new Panel();
ButtonTextEncrypter = new Button();
ButtonFileEncrypter = new Button();
ButtonFileReader = new Button();
ButtonMemeForge = new Button();
ButtonSettings = new Button();
SidePanelTitle = new Label();
SidePanelSlogan = new Label();
HFSCChkBox = new CheckBox();
showPasswords = new CheckBox();
TextboxUsername = new TextBox();
TextboxPassword = new TextBox();
TextboxEPAS = new TextBox();
UsernameTitle = new Label();
PasswordTitle = new Label();
DefaultEncryptionPassTitle = new Label();
AccentColors = new ComboBox();
AccentColorTitle = new Label();
AlwaysOnTop = new CheckBox();
DiscordFormatChkBox = new CheckBox();
TextboxASFLocation = new TextBox();
AutoSaveFilesChkBox = new CheckBox();
ButtonBrowse = new Button();
MFAPI = new Label();
TextboxMFAPI = new TextBox();
sidePanel2 = new Panel();
ButtonMods = new Button();
button1 = new Button();
panel1 = new Panel();
ReaderPage = new FileReader();
TextEncrypterPage = new TextEncrypter(this);
FileEncrypterPage = new FileEncrypter(this);
MemeForgePage = new MemeForge(this);
TerminalPage = new terminal(this);
Titlebar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)TitlebarIcon).BeginInit();
sidePanel2.SuspendLayout();
panel1.SuspendLayout();
SuspendLayout();
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
Titlebar = new Panel();
ButtonMinimize = new Button();
ButtonExit = new Button();
Title = new Label();
TitlebarIcon = new PictureBox();
TitlebarAccent = new Panel();
ButtonTextEncrypter = new Button();
ButtonFileEncrypter = new Button();
ButtonFileReader = new Button();
ButtonMemeForge = new Button();
ButtonSettings = new Button();
SidePanelTitle = new Label();
SidePanelSlogan = new Label();
HFSCChkBox = new CheckBox();
showPasswords = new CheckBox();
TextboxUsername = new TextBox();
TextboxPassword = new TextBox();
TextboxEPAS = new TextBox();
UsernameTitle = new Label();
PasswordTitle = new Label();
DefaultEncryptionPassTitle = new Label();
AccentColors = new ComboBox();
AccentColorTitle = new Label();
AlwaysOnTop = new CheckBox();
DiscordFormatChkBox = new CheckBox();
TextboxASFLocation = new TextBox();
AutoSaveFilesChkBox = new CheckBox();
ButtonBrowse = new Button();
MFAPI = new Label();
TextboxMFAPI = new TextBox();
sidePanel2 = new Panel();
ButtonMods = new Button();
button1 = new Button();
panel1 = new Panel();
ReaderPage = new FileReader();
TextEncrypterPage = new TextEncrypter(this);
FileEncrypterPage = new FileEncrypter(this);
MemeForgePage = new MemeForge(this);
TerminalPage = new terminal(this);
Titlebar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)TitlebarIcon).BeginInit();
sidePanel2.SuspendLayout();
panel1.SuspendLayout();
SuspendLayout();
5 Replies
Gυαɾԃιαɳ
GυαɾԃιαɳOP3w ago
I pass a self-reference and the code for it disappears but the object itself stays. Only if I edit the UI and save it.
Pobiega
Pobiega3w ago
InitializeComponent is usually generated by the winforms UI editor you shouldn't put your own stuff there
Gυαɾԃιαɳ
GυαɾԃιαɳOP3w ago
Yes. Well. I required a self-reference for some code to work. I don't know any other way...
Pobiega
Pobiega3w ago
just put the same code in the constructor, after/before the InitializeComponent() call its just code
Gυαɾԃιαɳ
GυαɾԃιαɳOP3w ago
Okay thanks for the help!
Want results from more Discord servers?
Add your server