Sorry about the delay. I’m helping my grandparents in Arkansas with a ton of stuff. Seven days straight of manual labor kind of stuff. I thought I’d have some time to write actual blogs while being down here, but haven’t found the time. I’m leaving here on Tuesday morning so you guys might see something that night or the next.
Thanks for being patient!
Hey guys, I know it’s been a while since I blogged. Just been dealing with some stuff at home. I’ll be blogging again soon, maybe even as early as tomorrow.
I’ve been on vacation for a week and this is the last night. I’ve also been working on a text editor for most of the nights during said vacation. You may have seen some images or code from it in my previous posts.
It was mostly a “let’s see how much I can learn about Visual C# text boxes in a few nights of programming a text editor” kind of thing. The code is very unorganized and sloppy, but I did learn a lot and was able to share some of it with you guys!
I don’t plan on releasing it on the app store unless I go back and redo the whole thing to make it more organized and actually use some OOP.
In this tutorial I teach you how to save settings to an internal config!
Saving settings to a config is really easy in C#, so let’s begin the tutorial!
1. Right-click on the project root in the Solution Explorer:
2. Select “Properties” from the list:
3. You should see something similar to this:
4. Set the names, types, and default values to whatever you like. DO NOT change the scope to “Application” if you plan on being able to edit the settings from the code.
5. Getting and Setting the property:
[Variable Type] [Variable Name] = Properties.Settings.Default.[Name of Property];
Properties.Settings.Default.[Name of Property] = [String, Int, etc. (As long as it is the same type as the property)];
In this example, I am checking if the config property LastSaveDirectory is not empty. If it is not empty, set the SaveFileDialog‘s Initial Directory to the stored property.
How to loop through all Properties and display them in a MessageBox:
NOTE: I would recommend a String Builder if you plan on having a lot of properties.
Going border-less full-screen in C#.NET is actually really, really easy.
1. Set the
FormBorderStyle to None:
FormBorderStyle = FormBorderStyle.None;
2. Set the
WindowState to Maximized:
WindowState = FormWindowState.Maximized;
You may or may not have to adjust the width/height and location of various controls on the form.
To return the form to normal:
1. Set the
FormBorderStyle to Sizable:
FormBorderStyle = FormBorderStyle.Sizable;
2. Set the
WindowState to Normal:
WindowState = FormWindowState.Normal;
Again, you may or may not have to adjust various properties of controls on the form after doing this.
NOTE: I only have to adjust a few properties when going full-screen, and the form returns said properties to their original state when returning to normal mode.
My first programming language was Python. I didn’t choose it because someone told me it was the easiest to start with or because of it’s vast collection of libraries and frameworks. I chose it because I thought the name was cool. That’s it. (Was in 8th grade at the time)
Looking back, I am so glad I chose Python. I used to be an instant gratification monkey, and Python was easy enough to pick up quickly. The vast collection of libraries and frameworks mentioned earlier prevented me from losing interest for quite some time.
I know I said Python was my first programming language, but this is only partial because of two distinct facts:
1. I started scripting in batch before Python. I knew the windows command line like the back of my hand as well as batch scripting before I touched Python.
There are so many different types of casing when it comes to variable names, but which one is the best you ask? Why, SCREAMING_SNAKE_CASE, of course.
Let’s compare a few cases just to show why screaming snake case is the best.
Screaming snake case really puts emotion into the code. It let’s the next person that works on your code know that you really felt strongly about the variable or function name you chose.
The other cases are cool and all, but none of them portray raw human emotion, meaning, and readability as well as screaming snake case.
What’s your favorite case? Tell me in the comments below!