Click here to Skip to main content
14,638,374 members

Welcome to the Lounge


For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
JokeRe: Oh man, my ears are melting. Pin
abmv10-Dec-18 8:10
professionalabmv10-Dec-18 8:10 
GeneralRe: Oh man, my ears are melting. Pin
DRHuff10-Dec-18 8:22
MemberDRHuff10-Dec-18 8:22 
GeneralOi! Pom Pey! Where's the CCC? Pin
OriginalGriff9-Dec-18 22:52
mveOriginalGriff9-Dec-18 22:52 
GeneralRe: Oi! Pom Pey! Where's the CCC? Pin
megaadam9-Dec-18 23:16
professionalmegaadam9-Dec-18 23:16 
GeneralThe last day... Pin
Kornfeld Eliyahu Peter9-Dec-18 20:13
mveKornfeld Eliyahu Peter9-Dec-18 20:13 
GeneralRe: The last day... Pin
Marco Bertschi9-Dec-18 22:39
professionalMarco Bertschi9-Dec-18 22:39 
GeneralRe: The last day... Pin
den2k889-Dec-18 22:47
professionalden2k889-Dec-18 22:47 
GeneralWhat I've Learned So Far Pin
SawmillTurtle9-Dec-18 17:45
MemberSawmillTurtle9-Dec-18 17:45 
Greetings. This is the first time I've ever posted here, so I supposed introductions are in order. The name is SawmillTurtle. Sawmill because I used to live on a street with that name, and Turtle because my friends used to say I look like Franklin the Turtle. I don't see the resemblance, but it makes for a good screen name.

For the past few months, I've been writing a program in C# for my landlord that keeps track of her rental properties, accounting and maintenance issues. It's an all-in-one kind of thing. I've been using SharpDevelop because of my intense hatred for any and all things Microsoft. I actively avoid using anything they make, so that means I don't use Visual Studio. A good alternative, some say, would be MonoDevelop but Microsoft owns that, too.

Up until I started on this project, I'd only tinkered with C# while playing with Unity. My IDE of choice was Game Maker because of the ease of use and the speed at which a program can be written using it. You can go ahead and laugh. It's funny. Game Maker is a good tool for learning programming concepts, but once you have it down it is really best to leave it behind you. I thought I could take everything that GM taught me and use it when I made the transition to C#.

Keep laughing. It's still pretty funny.

What I thought I knew going into this project and what I actually knew are two very different things. I've learned so much over the past few months. Looking back at the early sections of the code is like looking at a car with square wheels. Looking over it, I keep going, "Now why did I do that" and "What in the world was I thinking". One of my biggest mistakes-- and I just figured this one out yesterday-- was creating classes and then creating separate forms for those classes. It never occurred to me to make them one and the same.

Take this, for instance:

public void edit(BindingList h)
int i=-1;
HouseholdForm editHousehold;
editHousehold=new HouseholdForm(members,householdName,account,
foreach(HouseHold house in h)
if (house.householdName==householdName)

What you are looking at is part of the "Household" class. What this does is take all the necessary variables and pass them as arguments to HouseholdForm. If the user clicks the "Save" button, it passes back "saveMe" as true, which makes the class retrieve the edited values from the form. Then it switches its own "saved" flag, which MainForm uses to determine if it needs to update something.

Do you see how stupid that is?

Would it not have been easier to build the "Household" class as PART of "HouseholdForm"? Then I wouldn't have had to pass a bunch of variables and then retrieve them. Chalk that one up to inexperience. I'm planning a major overhaul where I correct this error, but that is going to be a tedious process. Since the program is functional-- albeit sloppy-- the way it is, my priority is getting my landlord the program she's been waiting for. The first update will include the cleaned up code.

Going into this, I had no idea what I was getting myself into. I've had to ask Google a LOT of questions, and most of those have pointed me to Stack Overflow. There have been days I've wanted to rip my hair out, and there have been days where I've had a lot of fun. Today was NOT one of the fun ones. I spent the better part of three hours trying to eliminate a bug that didn't seem to exist at the first, second, third... and hundredth glance.

I found it here, in this section of code:

foreach(bool paid in h.account.payment)
int ind=h.account.payment.IndexOf(paid);
double amount=h.account.amountOf[ind];
if (paid)

See, I was creating a DataGridView that displays all households that owe rent. The "HouseHolds" class has a class called "Account", which has several Binding Lists. Like this:

public BindingList<datetime> dateOf=new BindingList<datetime>();
public BindingList<double> amountOf=new BindingList<double>();
public BindingList<string> description=new BindingList<string>();
public BindingList<string> displayName=new BindingList<string>();
public BindingList<bool> payment=new BindingList<bool>();

These lists are all created, edited or erased at the same time. The "payment" Binding List is used to determine is someone OWES rent or is PAYING rent. So in the Switch statement at the top, I was using IndexOf and passing the number. It kept double or triple charging things. Sometimes it wouldn't charge them at all. I figured out that using IndexOf this way was wrong, because it was looking for the first Boolean value that it found in "amountOf" that matched what it received from "payment". Obviously, not a good idea. At one point, the program reported a household as owing over 1800 dollars in back rent. Oops.

So it's been an interesting journey. I think after I finish this, I'm going to try my hand at MonoGame. Eventually I'd like to work my way up to Unity. Maybe next time I'll actually be able to use it without having it go haywire.

First, though, I really need to figure out what casting is, because I have no idea what people are talking about when they mention that.

Thanks for listening.

Hope to talk to all of you very soon.

GeneralRe: What I've Learned So Far Pin
Rick York9-Dec-18 18:22
mveRick York9-Dec-18 18:22 
GeneralRe: What I've Learned So Far Pin
Peter_in_27809-Dec-18 18:33
professionalPeter_in_27809-Dec-18 18:33 
GeneralRe: What I've Learned So Far Pin
SawmillTurtle9-Dec-18 21:13
MemberSawmillTurtle9-Dec-18 21:13 
GeneralRe: What I've Learned So Far Pin
Marco Bertschi9-Dec-18 22:43
professionalMarco Bertschi9-Dec-18 22:43 
GeneralRe: What I've Learned So Far Pin
Marc Clifton10-Dec-18 3:14
mvaMarc Clifton10-Dec-18 3:14 
GeneralRe: What I've Learned So Far Pin
OriginalGriff9-Dec-18 20:26
mveOriginalGriff9-Dec-18 20:26 
GeneralRe: What I've Learned So Far Pin
SawmillTurtle9-Dec-18 21:23
MemberSawmillTurtle9-Dec-18 21:23 
GeneralRe: What I've Learned So Far Pin
PeejayAdams9-Dec-18 22:29
MemberPeejayAdams9-Dec-18 22:29 
GeneralRe: What I've Learned So Far Pin
den2k889-Dec-18 22:42
professionalden2k889-Dec-18 22:42 
GeneralRe: What I've Learned So Far Pin
PeejayAdams9-Dec-18 23:14
MemberPeejayAdams9-Dec-18 23:14 
GeneralRe: What I've Learned So Far Pin
den2k8810-Dec-18 0:00
professionalden2k8810-Dec-18 0:00 
GeneralRe: What I've Learned So Far Pin
theoldfool10-Dec-18 1:26
professionaltheoldfool10-Dec-18 1:26 
GeneralRe: What I've Learned So Far Pin
Richard MacCutchan9-Dec-18 23:35
mveRichard MacCutchan9-Dec-18 23:35 
GeneralRe: What I've Learned So Far Pin
den2k889-Dec-18 23:56
professionalden2k889-Dec-18 23:56 
GeneralRe: What I've Learned So Far Pin
Richard MacCutchan10-Dec-18 4:33
mveRichard MacCutchan10-Dec-18 4:33 
GeneralRe: What I've Learned So Far Pin
PeejayAdams10-Dec-18 0:35
MemberPeejayAdams10-Dec-18 0:35 
GeneralRe: What I've Learned So Far Pin
Richard MacCutchan10-Dec-18 4:36
mveRichard MacCutchan10-Dec-18 4:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.