Subscribe to Vb Peasy Lemon Squeezy        RSS Feed
- - - - -

Loop The Loop (For Loop)

Icon Leave Comment
The basic structure of a For Loop

For {Current} As {Type} = {From} To {UpTo} Step {Stepping}

...

Next

Where:
{Current} = Variable
{From} = Constant or Variable
{UpTo} = Constant or Variable
Optional
{Stepping} = Constant or Variable


Writing a loop that goes from 1 to 10

...
- - - - -

Recursive Methods.

Icon Leave Comment
Recursive Methods are method that called themselves from with the body of their definition.

Lets do the classic Fibonacci
 Public Function Fib(ByVal x As Integer) As Integer  If x < 1 Then Return 0  Return Fib(x - 1) + x End Function



To see how it works lets step through it manually.

...
- - - - -

Project 4: Methods (Functions)

Icon Leave Comment
Function are like Subroutines which can also return a value.

The Layout of a Function.


Function Method_Name( Parameters ) As Type
 { Code of Function }
  Return {Object or Value}
End Function
...
- - - - -

Project 3: Methods (Subroutines)

Icon Leave Comment
Methods (Subroutines)

There are two basic types of method in VB.NET, the Subroutine and the Function.

Using Methods lets you break up code, into separate reusable sections (Methods) of code.

The difference between is this
A Function returns a value, whereas a Subroutine doesn't.

You have been using a Subroutines, without knowing.

...
- - - - -

Comparisons

Icon Leave Comment
Comparison Operators
These operations compare the relative values of the items being compared.
Takes: ObjectA Comparison_Operand ObjectB
Returns: Boolean (Note: This is Generally True, but not always. Why is for a later Post.)


=    Equals To

The simplest of them. Do this equal that?
...
- - - - -

Logic

Icon Leave Comment
Boolean Logic Operators
Not
Evaluates the opposite value. This called Negation.

A      Z
False  True
True   False


Dim A As Boolean = FalseIf Not A Then Console.WriteLine("A was False")End If


AND
When A and B are both True value is True, otherwise value is False.

A      B      Z
False  ...
- - - - -

Conditionals (IF Statements)

Icon Leave Comment
So far the code you have seen has been very simple, today I'm going to introduce a new concept.
That concept is conditionals.

Conditional

A conditional is an expression that when is evaluated returns a Boolean (True or False).

The most basic structure for a conditional is that of the IF statements

If {Condition Exp...
- - - - -

Project 2: Variables

Icon Leave Comment
Defining a Variable

Dim {Variable Name} As {Type}

What this saying is reserve me a piece of memory big enough to store an object of this type and name a reference to that location with the variable name.

Module Module1  Sub Main()    Console.WriteLine("Variables")    Dim A As Integer   End SubEnd Module
...
- - - - -

Your First Project: Hello World.

Icon Leave Comment
Your First Project.
For your first introduction to vb.net code, I going to choose the Console Application.
This is so you can learn the basics of the language.

Change the Project Name to Hello World
Select project type: Console Application
Click OK
And type the follow piece of code into the code window.

...
- - - - -

Getting Started

Icon Leave Comment
Getting Started.

If you haven't installed the vb.net 2010 Express Edition, please go back to the previous blog post.

When the VB10 Express IDE is started the first screen presented to you is the start page.
...

  • (2 Pages)
  • +
  • 1
  • 2

August 2014

S M T W T F S
     12
3456789
10111213141516
171819 20 212223
24252627282930
31      

Recent Entries

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)

,.,

-.-