r/visualbasic • u/LakeAire • Dec 10 '17
Hey r/VisualBasic! I did my high school senior exit project in VB! It's a little digital assistant. Feel free to check it out!
https://drive.google.com/file/d/1P_woLkbZnrdPeQjI3jTDVWM06LkYHTcJ/view?usp=sharing2
u/ocdtrekkie Dec 12 '17
One of the things you probably want to look at doing in the future, particularly if you end up expanding this (my assistant is for my daily use, so I regularly improve it) rather than just submitting for the grade, is decreasing code replication.
Any time you have to do something repeatedly, there is probably a better way to do it.
For instance this function (IsNumeric): https://msdn.microsoft.com/en-us/library/6cd3f6w1(v=vs.90).aspx can make lines like this: https://github.com/beingDevisor/SeniorProject/blob/master/Form1.vb#L72 or this: https://github.com/beingDevisor/SeniorProject/blob/master/Form1.vb#L81 much shorter.
L72 could be "If IsNumeric(strInput.Chars(0)) Then" for example.
The other thing you'll likely find quite exciting is Select Case: https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/select-case-statement#example which works on not just integers like the example, but string as well.
Sections like "If strSign = "-" Then" lines could be entirely replaced with Select Case strSign, and then where each case was a string for the operator like Case "+".
2
u/LakeAire Dec 12 '17
The IsNumeric looks like it'll make coding a lot easier. Thanks for the tip!
I remember learning about Select Case way back in sophomore year when I took computer programming 1, but I couldn't remember how to do it lol. Thank you so much!
2
u/ocdtrekkie Dec 12 '17
The .NET class library is insanely deep in terms of stuff it can do built-in. Sometimes I just wonder "hey, is there a .NET function to do that" and go searching around on the Internet, and find out there is. Microsoft's documentation can be a bit hard to find on it, but it's pretty good once you get in there.
2
2
u/ocdtrekkie Dec 13 '17
Any other questions you have in the future about VB, GitHub, or what I did in my project, lemme know! Your code and mine have a bit in common, so I'd be super curious if there was a new feature you came up with or the like.
And of course, my project's MIT licensed, so feel free to borrow anything that interests you out of it, or if you're curious about how or why I did something, let me know. (There's actually several really easy ways to crash mine, for what it's worth, do not take how I wrote my project to be the end-all best way to do things. ...It's not.)
3
u/ocdtrekkie Dec 11 '17
I'd recommend putting code on GitHub, or providing some screenshots or details. I am intrigued a little bit (because I have some assistant-ish software in VB as well), but not enough to download and unpack a RAR.