✅ .NET 9.0 - CSharp WinForms (Closed Case)

In order to get the best help I need I shall provide a little background to my application I have been working on for the past year. Encryption Forge is my application name with many features. Recently I reached to this point where I received an error that is unrelated and I don't understand. This error prevents the application from running and thows a object reference error. However the object reference error is not the main problem. It is something within the InitializeComponents or in the loading of public Main(). I tried to narrow it down but if I remove everything or bits from the Loading of public Main() it works and then if I do the same it doesn't. Im confused so much. Something you may need to know is that I am not a professional. I use hand made code, code snippets and a bit of help from ChatGPT (Not often though). So my code is wack and disorganized if I do say so for myself. I want to hand off the project by files but It's supposed to be a secure software no one can have other than me and my friends. This software can not be seen by others (The public). If I could get a private person it would be helpful.
20 Replies
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
There may be many unprofessional or unique dumb ways I done things or unoptimized ways. If its possible for me to get assistance on optimizing and improving the application that can help too. It could resolve my many unknown errors. Also Unfortunately ChatGPT couldn't even resolve this error.
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
I receive this whenever I load the application
No description
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
However that isn't the actual error and I have no clue why it is going there and saying its an error. That code is 110% fine and I know it. Its something whenever it tries to load Main. some thing in this part of the code is preventing it from actually loading the application. No matter what I remove unless I remove all it doesn't work.
namespace Encryption_Forge
{
public partial class Main : Form
{

[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
private static extern bool ReleaseCapture();

private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;

public Main()
{
InitializeComponent();
UpdateAccent();

Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));

TextEncrypterPage.Visible = false;
FileEncrypterPage.Visible = false;
MemeForgePage.Visible = false;
TerminalPage.Visible = false;
ReaderPage.Visible = false;

TextboxUsername.Text = Properties.Settings.Default.Username;
TextboxPassword.Text = Properties.Settings.Default.Password;
TextboxEPAS.Text = Properties.Settings.Default.EncryptionPass;

AutoSaveFilesChkBox.Checked = Properties.Settings.Default.ASF;
ButtonBrowse.Enabled = Properties.Settings.Default.ASF;
TextboxASFLocation.Enabled = Properties.Settings.Default.ASF;

TextboxASFLocation.Text = Properties.Settings.Default.ASFLocation;
TextboxMFAPI.Text = Properties.Settings.Default.mfapi;

this.FormClosing += new FormClosingEventHandler(ButtonExit_Click);

showPasswords.CheckedChanged += showPasswords_CheckedChanged;
AccentColors.SelectedIndexChanged += AccentColors_SelectedIndexChanged;
}
namespace Encryption_Forge
{
public partial class Main : Form
{

[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
private static extern bool ReleaseCapture();

private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;

public Main()
{
InitializeComponent();
UpdateAccent();

Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));

TextEncrypterPage.Visible = false;
FileEncrypterPage.Visible = false;
MemeForgePage.Visible = false;
TerminalPage.Visible = false;
ReaderPage.Visible = false;

TextboxUsername.Text = Properties.Settings.Default.Username;
TextboxPassword.Text = Properties.Settings.Default.Password;
TextboxEPAS.Text = Properties.Settings.Default.EncryptionPass;

AutoSaveFilesChkBox.Checked = Properties.Settings.Default.ASF;
ButtonBrowse.Enabled = Properties.Settings.Default.ASF;
TextboxASFLocation.Enabled = Properties.Settings.Default.ASF;

TextboxASFLocation.Text = Properties.Settings.Default.ASFLocation;
TextboxMFAPI.Text = Properties.Settings.Default.mfapi;

this.FormClosing += new FormClosingEventHandler(ButtonExit_Click);

showPasswords.CheckedChanged += showPasswords_CheckedChanged;
AccentColors.SelectedIndexChanged += AccentColors_SelectedIndexChanged;
}
No errors exist unless I load the application and I showed that error. Which doesn't make any sense.
ero
ero4w ago
i have strong doubts that this is a legal software. since we can't verify that you aren't creating something that violates another app's TOS, you likely won't find much help here. you have to find out what's null. play with the debugger, change your exception settings (disable just my code, enable all exceptions). even if it were okay to help you, there is nothing to do without more knowledge.
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
What do you mean by violates another apps TOS? this is my code ive been working on? I understand you can't help. But I don't understand what you mean by violting another apps tos? This has been a personal project for all of 2024. I don't even know any encryption softwares with nearly the amount of features that I have. and also its not being released to public. This is personal use.
ero
ero4w ago
capturing the mouse cursor, sending messages to other windows, not wanting to share the project. it's just all hallmarks of creating something malicious, which this server sees often enough. we need to be careful.
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
Oh, I see. This is supposed to be a secure software so I made it so It can't be traced or be seen by public. Encryption. Only between me and my friends I understand that it happens a lot. You may not be able to help me for that reason and the lack of knowledge and understandment. It's okay. I'll try to figure it out eventually :/
ero
ero4w ago
if i may offer my two cents. the software should not need to be closed source. you and your friends could have private encryption keys instead.
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
The capturing of the mouse cursor is to allow the ability to drag the application around with my custom titlebar What do you mean?
ero
ero4w ago
anyway i've said what may help
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
okay, thanks for the help.
ero
ero4w ago
you know. files or strings used to encrypt/decrypt other files. of course i don't know your algorithm, but that's a solution i might use. that way i can make the algorithm public and users can still encrypt safely unless you also have the file or string, you wouldn't be able to decypt the contents.
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
mm.. I guess. I don't like to have open source projects though.
ero
ero4w ago
feel free to come back when you found out more about where the error comes from.
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
okay
ero
ero4w ago
you're entitled to that opinion, but it helps users trust your software much more. but that's a topic for another day (you can decide how much it matters for each project, of course)
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
Trust my software? I don't like to make it public at all though. Not even just for fun or any of that. My friend group is all the people I will ever give.
ero
ero4w ago
wasn't specific to this project (since your answer was generalized as well)
Gυαɾԃιαɳ
GυαɾԃιαɳOP4w ago
true. I understand. Thanks for the help. Adios I found the error. Under one of my pages I created was calling a reference error into the main. It was not properly defined. I had to dive deeper and bypass the top level error. The one I showed. I made it not show that error and it took me directly to where the actual error was. Easy fix. Thanks!
MODiX
MODiX4w ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server