ok i get your point, but do you think i should have my forms in separate files?
Printable View
ok i get your point, but do you think i should have my forms in separate files?
The general rule is that each class is in it's own CS file. You never put more than one class in a file. Therefore each form is also in it's own CS file.
If you have a class which contains many subclasses inside it (see example below) sometimes it is useful to write each of those subclasses in a different CS file and make the "Test" class a partial class, similar to what you're doing now.
Also, google for the MS guidelines on naming variables and methods. It is very good to adopt a coding standard and stick to it, it may as well be the MS one.Code:public class Test()
{
public class InsideClass()
{
}
public class InsideClass2()
{
}
public class InsideClass3()
{
}
}
Lastly, as a general rule of thumb, the length of the name of a variable should be proportional to it's scope. For example if you're writing a for loop, you'd use:
for(int i=0; i < blah, i++)
But if you have a variable that's going to be alive for quite a while, give it a descriptive name. As a (bad) example, you wouldn't name a class "a" because that's not descriptive and no-one will know what it's for.
There is one additional point, which explains you why to use of descriptive names. Programs very quick exceeds to bigger projects. I have e.g VB applications with 100.000 lines and more. In debug time its much easier then to read txtFamilyName.Text and txtPhoneNo.Text then only to have txt1.Text ... You know what you have in front of you, which usage it is and just where you are running through your code. Believe me, Debugging sometimes is needed years after you have written some code. People want add ons to your program, you have written lots of other things in between and you do never remember each piece of code you have done and why. In all this cases giving descriptive names and a good inline documentation or a header dokumentation helps to reunderstand difficult codeparts. So when we do
or what I showed you createing regions is very helpful when the code exceedsCode:// some text as explanation
I'll give you a small example
Please tell me what I'm doing here ? nobody knowsCode:class C
{
// includes Property FN, SN, T,P,Fx,E,St,... Method S();
}
// somwhere in the program declared you have
private C1 = new C(); //on a form you have a button btS and its click delegate like
private void btS_Click()
{
C1.S();
}
and in difference
What do you think you will be able to read easier after some years ? What do you think is easier to read for people who are asked to find codeproblems ?Code:class Customer
{
// incluses Property FirstName, SurName, Title, Phone, FAX, Email, Street, ... Method Store();
}
Private myCustomer = nw Customer();
private void btStore_Click()
{
myCustomer.Store();
}
For the full picture, just as explained before by Mutant_Fruit. There is no probleme to have SW for the writerstream and SR for your ReaderStream as they are used in some few lines and have a short lifetime.
But it can make troubles ( especially if others should debug, to have a richtextbox and giving it a wrong descriptive name like textbox1. People will not look for a richtextbox when there is textbox1. ( especially when in your post there is explaiined you have troubles with richtextbox1 !! )
Normally using a descriptive name, as this is your main editorwindow it would get a name just describing that e.g. RtbMainEditor if you still prefer the hungarian notation, which has lost its importance in C# naming rules But I think this is still accepted by most C# programmers. If you dont want using that Style you also can name it MainEditorRtb.
Both will enable more easy reading your code. You will get much more people willing to help, when they are looking to your code. ;)
So I think this would be worth to reorganize your program.
And: As you have proven now to yourself that you are able to get a design without any automatic designer, now come to normal standard and use the designer using the wizzard. Its code will be placed on a separate page, so you easily can see that its created automatically, you can design your form as you want and you will see it at designtime how it looks, so it also saves your time, which you can invest in creating the real functionality.
This also makes sure that your code has a correct Dispose() Method ( which is still missing in your code ).
Doing all that, we really would enjoy reading your code, because it looks as you are able to learn it, only needs to overcome a bit of stubborn habits (- which- we Austrian say, are quite normal for a nothern born 'Wild'. :D And 'Northern Wilds' are all the people living in the geographic line of Hamburg or more northwards :D 'Wild' is german slang meaning people not civilised, just as we have the picture of the barbarians :lol: :lol: )
ok, thanks. i get your point =)
I'll change it right away, and change my program to what you call standard structure.
I'll get back to you.
Great to hear that. Post the new Project in a zip file as usual ( if you have no winzip its freeware on the net for 30 days trial but works longer too.( its then remembering you that should buy it - and you should really do as it is cheap and worth the price. )Quote:
Originally Posted by dahwan
Jonny,Quote:
Originally Posted by JonnyPoet
Actually you dont even need it, just "SendTo-->Compressed Folder"
Our programming master, ladies and gentlemen! :DQuote:
Originally Posted by JonnyPoet
(Just so you know, its WinRar thats 30 days free then buy, not WinZip) :)
A yea, I have winzip since years so I never tried it with the OS directly;)Quote:
Originally Posted by TheCPUWizard
I'm using Winzip as a regular user since years and as I remember its also a 30 days trial there. I dont think they would have changed that in the time since I bought it.Quote:
Originally Posted by dahwan
So first look, before you come back to old habits only being antagonistic. :rolleyes:
Yay! All shortcuts working, all tags being added correctly, run file works ---
Here is the first release of my web development kit (sounds much cooler than it is)
Say hello to v.1.00.0 :D
I actually expected some comments on the last post, but i guess that's out the window... :P
What should be commented on your EXE file. We have told you in former posts we never run compiled code. I expected a reordered project with code using correct naming of fields, classes ... filed in the correct way , just as I described you, you should do. Instead you are posting a compiled project where nobody knows whats in it and if you have changed your unusual programming style. So what should I comment. reread forum rules, that my comment on posting an exe fileQuote:
Originally Posted by dahwan
-.-
Dude, you seriously don't trust me? you've been with me from the start man ^^
you should know i couldn't have coded a virus in a million years.
How can you ever download any software from the internet? its all exe...
Come on, i swear its the project I've been working on. I wish one of you had the guts to try it and tell everyone its safe :(
I want someone else than me to try it and comment it. Not from the code, but from the GUI.
Plz :(
I just don't have the time to gather up all the code and zipp'em down and send them. Compiling it to one file and sending it is sooo much easier :(
What if you happen to have a virus on your computer that has infected your program? Stranger things have been known to happen. In most forum's I've been in, it is standard practice to not run from an exe.Quote:
Originally Posted by dahwan
Hi, This post is very informative, however I would like some specific information. If someone can help me then please send me a private message. Best Regards,
Pakistan Property | Wholesale Suppliers
Wholesale Canadian Directory | All UK Wholesalers