|
-
May 22nd, 2013, 02:54 PM
#1
Thread Starter
New Member
Hi im new
Hi i just registerd i couldnt see an introduce yourself thread so here it goes i am quite new to visual basic iv been reading alot and was wondering if theres a pack or somthing to tell you codes, i really want to get into this properly and was thinking about maybe making a small game or programme but when seeing all this codes on the code input page it looks like mumbo jumbo. is there a place for beginners.
If this site is for experts only i appolagise and will not bother you.
-
May 22nd, 2013, 05:57 PM
#2
Re: Hi im new
Hi and welcome to the VBForums. 
This is a place for everyone that uses VB regardless of their level of knowledge and if they use it professionally or are just hobby programmers.
If you like to get some example code to look at and learn from we do have our CodeBank and UtilityBank forums in which people post source code that either do some small thing that you can use within your own application or full utility applications. In those forums you'll also find a lot of small tutorials with example code that you can follow. Check them out.
Since you're new I just want to mention that we moderate the first few posts you do so don't be surprised if you post a question and it doesn't show up immediately, this is just to seed out people that sign-up just to spam us. This chit-chat forum is mainly for fun and almost everything goes on in here, however posts you make here does not register in your post count. If you look at your current post count it still reads as 0 posts. So don't just post in here because then you will never get out of the moderator queue. 
If you happen to post something in the wrong forum and some member points this fact out to you then don't be alarmed, we all make mistakes. However, in that case click on the small report icon (in the current version of this forum it's a small black triangle icon under your user name) and ask for the thread to be moved. Please do not go to the correct forum and post the same question again, we prefer to simply move the thread instead of having duplicate threads in different forums.
A good tip to get the most replies to any question you might have, is to create a thread with a useful title and describe your problem as good as you can. It's always helpful if you post the code that you've tried to use. When posting code please insert them into [code] and [/code] tags, that way all formatting (such as indentation) are preserved which makes it a lot easier to read.
Good luck!
-
May 22nd, 2013, 06:32 PM
#3
Re: Hi im new
And if you need help making games, then Im your man. Im the game expert in VBForums. Just ask anything in the Games and Graphics section and id be more than willing to help 
Also stay away from those dreadful Timers if youre gonna make a game.
-
May 23rd, 2013, 04:32 AM
#4
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
May 23rd, 2013, 06:50 AM
#5
Thread Starter
New Member
Re: Hi im new
EDIT: thanks all for your replys, during the time my post was getting checked by modder i did sum reading (alot of reading was late for work due to over sleep haha) and found sum useful tips here and else where,i actually managed to make a calculator IT ONLY HAD A + BUTTON AND = but even so i was well chuffed started to learn the DIM command and a few other codes i can see myself having fun on this forum learning stuff and hopefully progressing.
-
May 23rd, 2013, 06:57 AM
#6
Re: Hi im new
IT ONLY HAD A + BUTTON AND = but even so i was well chuffed
Finally somebody who doesn't start their programming career by trying to write a massively-multi-user-first-person-shooter or their own answer to facebook. If you're starting with the simple stuff and enjoying it then you've got exactly the right mindset and will probably go far. The complex stuff will come soon enough.
Last edited by FunkyDexter; May 23rd, 2013 at 07:04 AM.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
May 23rd, 2013, 09:03 AM
#7
Re: Hi im new
 Originally Posted by FunkyDexter
 Finally somebody who doesn't start their programming career by trying to write a massively-multi-user-first-person-shooter or their own answer to facebook. If you're starting with the simple stuff and enjoying it then you've got exactly the right mindset and will probably go far. The complex stuff will come soon enough.
Like me who started making a Quake clone using pictureboxes o.O......................that was a joke btw
-
May 23rd, 2013, 12:25 PM
#8
Re: Hi im new
Looks like I will need to buy more vodka
-
May 23rd, 2013, 01:00 PM
#9
Thread Starter
New Member
Re: Hi im new
thanks mate yeah i guess its better to learn the basic stuff first for starters i find it a lil hard to remember the codes like dim this to this then bla bla its sooo hard haha
 Originally Posted by FunkyDexter
 Finally somebody who doesn't start their programming career by trying to write a massively-multi-user-first-person-shooter or their own answer to facebook. If you're starting with the simple stuff and enjoying it then you've got exactly the right mindset and will probably go far. The complex stuff will come soon enough.
-
May 23rd, 2013, 07:07 PM
#10
Re: Hi im new
 Originally Posted by uksidnus
thanks mate yeah i guess its better to learn the basic stuff first for starters i find it a lil hard to remember the codes like dim this to this then bla bla its sooo hard haha
I'm going to give you the best advice you can get as a beginner in VB. Start all new projects with Option Strict turned On! For some reason, even though I've complained about it to the VB language team at Microsoft for years now, this option is turned off by default. If you start learning with this turned on you will become a much better programmer a lot quicker than if you leave it off.
To turn it on for all new projects click Options on the Tools menu and expand the Projects and Solution node in the tree to the left. Select the VB Defaults node and change the Option Strict option from Off to On. Leave the other options as On and the Option Compare option as Binary (these should be the default settings). Click OK.
For any project that you already started on you can change the setting by clicking on the <Project Name> Properties item on the Project menu. Select the Compile tab and change the Option Strict option to On.
So what will this do? Well, as the option name implies it will make the compiler a lot stricter and it will stop allowing implicit conversions of one type to another. As you've already noticed there are many different types in VB, such as Integer, String, Single, Double, and so on. These are all different, a string is some text while an integer is a numeric type so something that accepts a String (such as the Text property of a Label or a TextBox) does not know what an integer is. Assigning an integer value to such a property means that VB needs to convert the integer into a string. When you have Option Strict turned On, you need to tell the compiler that this is actually what you want to do. This might seem cumbersome at the beginning but I promise you that you will thank me later on. You don't have to read to many questions in the VB.Net forum here to realize that many of the questions are because people haven't learned to do the conversion explicitly instead of letting the compiler second guess you and make assumptions of what you really want to do.
So do yourself a favour and turn it on for your little calculator project. When you now get errors that you didn't have before and wonder what to do with them, post a question over at the VB.Net forum and we will tell you how to correct your code. You will learn so much more in a fraction of the time it would take you otherwise, and you will become a much better programmer as a result.
I'm pretty sure that everyone else that have posted in this thread will agree with me on this point.
Last edited by Joacim Andersson; May 23rd, 2013 at 07:11 PM.
-
May 24th, 2013, 03:03 AM
#11
Re: Hi im new
I'm pretty sure that everyone else that have posted in this thread will agree with me on this point.
Definitely! And I think it's worth mentioning Option Explicit and Option Infer too.
Option Explicit forces you to declare (DIM) all variables in the first place. You should have it set to on.
Option Infer allows you to declcare a variable and have it's type "inferred" from the value you first give it. E.g. Dim i = 12 will infer that i is an integer as opposed to having to say Dim i as Integer = 12. You should have this one switched off.
If you're paying attention you'll notice that this is probably the least "freindly" set up because it forces you to be absolutely explicit about the way all your variables are managed. But that is, of course, the point. It's forcing ggod habits on you. Think of these settings as your parents, guiding you through life and teaching you all the things you need to learn, even when you don't really want to. Turning them off (or on in the case of infer) is the equivalent of moving in with a bunch of your mates, staying up late, drinking too much and not eating properly. That's fine when you're 18 and you've learned a bit about life but if you start out like that when you're 5 you'll be a car crash before you hit adolescence.
I do enjoy a metaphor
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
May 24th, 2013, 04:22 AM
#12
Re: Hi im new
Hi,
I agree with everything that has been said by both Joacim Anderson and FunkyDexter however I thought I would add an additional point when it comes to turning Option Infer Off. Even through I totally agree that all your variables should be EXPLICITLY declared before use, some variable declarations can be a bit complicated to deduce which therefore makes it difficult to declare your variable types. So, what do I mean by this?
As you delve deeper into VB and gain more experience you will come across more complicated variable declarations. At this point do NOT try and understand this code but as an example have a look at this:-
Code:
Option Infer Off
Public Class Form1
Private Sub Button2_Click_1(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim myIntegers() As Integer = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3}
Dim myNumberGroups As System.Collections.Generic.IEnumerable(Of System.Linq.IGrouping(Of Integer, Integer)) = myIntegers.GroupBy(Function(x) x)
For Each numberGroup As IGrouping(Of Integer, Integer) In myNumberGroups
Console.WriteLine("Group : " & numberGroup.Key.ToString & " has " & numberGroup.Count.ToString & " occurances")
Next
End Sub
End Class
Even though this is the correct way to Explicitly declare everything in this code snippet, you can see that the myNumberGroups variable declaration is one heck of a mouthful, to not only say, but also to remember.
This is where Option Infer On can be really useful since with Option Infer set to On you can INITIALLY write the above as:-
Code:
Option Infer On
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim myIntegers() As Integer = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3}
Dim myNumberGroups = myIntegers.GroupBy(Function(x) x)
For Each numberGroup In myNumberGroups
Console.WriteLine("Group : " & numberGroup.Key.ToString & " has " & numberGroup.Count.ToString & " occurances")
Next
End Sub
End Class
You can now Hover your Mouse Cursor over the Declaration of the variable myNumberGroups and Visual Studio Intellisense will immediately tell you the Type of variable that has been inferred by Visual Studio for this variable based on what information is being assigned to this variable. You can now edit your code to Explicitly declare this variable based on what Visual Studio has told you what it needs to be.
To finish then, my personal opinion, is to keep Option Infer On, but at the same time, ALWAYS Explicitly declare your variables and only use Option Infer to help you identify the Types that your variables should be declared as.
Hope that helps.
Cheers,
Ian
-
May 24th, 2013, 04:30 AM
#13
Re: Hi im new
That's exactly the sort of thing he might want to do.... when he's 18.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
May 24th, 2013, 07:12 AM
#14
Re: Hi im new
 Originally Posted by FunkyDexter
Option Infer allows you to declcare a variable and have it's type "inferred" from the value you first give it. E.g. Dim i = 12 will infer that i is an integer as opposed to having to say Dim i as Integer = 12. You should have this one switched off.
I do not agree with that point. I think Option Infer should be On, I use it all the time. Not for simple things like Dim i = 12, but when you go into LINQ you really need it. I also use it in the cases where an object is constructed for you:
Code:
Using stream = tcpClient.GetStream()
'...
End Using
'Instead of:
Using stream As NetworkStream = tcpClient.GetStream()
'...
End Using
I also use it when I need to cast an object:
Code:
Dim item = DirectCast(ListBox1.Items(0), MyCustomListItemObject)
When using the above it feels really repetitive to have to type:
Code:
Dim item As MyCustomListItemObject = DirectCast(ListBox1.Items(0), MyCustomListItemObject)
This is however a matter of style and I think the OP can decide for himself which style that will fit him in the future and that's the reason I don't think you should tell a new user that this option should be turned off since you then deny him his right to make up his own mind about it. Turning Option Strict On is another matter since it forces you to learn best practices which is a good thing.
Last edited by Joacim Andersson; May 24th, 2013 at 07:17 AM.
-
May 24th, 2013, 02:29 PM
#15
Re: Hi im new
I have heard arguments that people starting out should leave Option Infer off, and I tend to agree. I also agree with the point made by IanRyder, and I, too, like using Option Infer. My concern with Option Infer is that if you are starting out you may not use it to help you, and may end up using it to confuse you. If you are unclear on data types, letting the compiler infer the type, while it works, hides the existence of data types to some modest extent. If you are using Option Infer to answer the question, "What type does this expression return?", then I think that Option Infer has some value when learning. If you are using Option Infer to remove your need to fully understand what you are doing, then that would be a negative value.
I tend to say that Option Infer should be off when starting out, but can then be turned on when you are comfortable with data types. As long as you have Option Strict ON, you will become comfortable with data types pretty quickly, too.
My usual boring signature: Nothing
 
-
May 26th, 2013, 08:03 AM
#16
Thread Starter
New Member
Re: Hi im new
hi again sorry to be a pain i posted this over in the general forum " hi all not long into the coding scene made my first calculator from scratch to learn a little, struggling a bit with the more complex stuff i was wondering if there is any projects or anything i could do in order to advence my skills im currently using this tutorial http://www.homeandlearn.co.uk/NET/nets1p20.html" however i got no replys im thinking its because my post status only says 1 and it probs looks like im jumpin on a forum to get things straight into my hand without research however that certianly isnt the case iv had so little sleep since starting this im enjoying it.
so to cap off: is that a good place to learn also is there any little projects i can do to advance my skills or just carry on with that thanks.
 Originally Posted by Joacim Andersson
I do not agree with that point. I think Option Infer should be On, I use it all the time. Not for simple things like Dim i = 12, but when you go into LINQ you really need it. I also use it in the cases where an object is constructed for you:
Code:
Using stream = tcpClient.GetStream()
'...
End Using
'Instead of:
Using stream As NetworkStream = tcpClient.GetStream()
'...
End Using
I also use it when I need to cast an object:
Code:
Dim item = DirectCast(ListBox1.Items(0), MyCustomListItemObject)
When using the above it feels really repetitive to have to type:
Code:
Dim item As MyCustomListItemObject = DirectCast(ListBox1.Items(0), MyCustomListItemObject)
This is however a matter of style and I think the OP can decide for himself which style that will fit him in the future and that's the reason I don't think you should tell a new user that this option should be turned off since you then deny him his right to make up his own mind about it. Turning Option Strict On is another matter since it forces you to learn best practices which is a good thing.
-
May 26th, 2013, 01:28 PM
#17
Addicted Member
Re: Hi im new
so let me get this straight you are done writing a calculator and you are using a tutorial with it .. now you wanna know is there any other project that you can do ? my first vb project was kinda funny cause it was a maximum screen that colors changing and theres no way to minimize it beside taskbar ... thats an idea
and and if you are talking about you post is 1 ( it confused me you are talking about this forum or not)..even if u had 2000000,00000 you'll get the same answer as 1 post...
-
May 26th, 2013, 02:47 PM
#18
Re: Hi im new
 Originally Posted by uksidnus
hi again sorry to be a pain i posted this over in the general forum " hi all not long into the coding scene made my first calculator from scratch to learn a little, struggling a bit with the more complex stuff i was wondering if there is any projects or anything i could do in order to advence my skills im currently using this tutorial http://www.homeandlearn.co.uk/NET/nets1p20.html" however i got no replys im thinking its because my post status only says 1 and it probs looks like im jumpin on a forum to get things straight into my hand without research however that certianly isnt the case iv had so little sleep since starting this im enjoying it.
so to cap off: is that a good place to learn also is there any little projects i can do to advance my skills or just carry on with that thanks.
I've replied to your other thread (which was moved into the Visual Basic.Net forum). You shouldn't repeat the same question here.
-
May 26th, 2013, 10:09 PM
#19
Re: Hi im new
Also, you really shouldn't post serious threads about coding in chit-chat. This particular thread had lots of reasoned, code-related, questions and would have been quite suitable in the .NET forum once it got going (after the first few introductory posts).
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|