Saturday, September 26, 2009

Email me

I would like you to write me an email with the following information:

  • Your name
  • Any programming experience
  • Why you are taking this class
  • What you hope to gain from this class
  • Any other information you'd like me to know

david.freer@gmail.com

Tuesday, September 8, 2009

First class code!

Here is the code from the first class!

First class

My email address:

david.freer@gmail.com

Please email me if you have any questions!

Install VB Express.

Thursday, July 9, 2009

DOCUMENT 1.

To publish the project, follow the Wizard under Build -> Publish.

From the UK

This example shows step by step how to connect a database to a VB.NET program.

In my opinion, this is the best tutorial I have found to connect a database and a VB.NET forms application without using the Wizard. Everything is step by step and done without much jargon or added complication. I think you will find it useful.

Remember: For the time of day=
Now.TimeOfDay.ToString

Excellent Links for DB Programming

This is a school database example that can be used as a template to create a working application. Click here.

Tuesday, July 7, 2009

Student...Graduate Student

Create a student class with two attributes and getters and setters.

Create a graduate student class with one other attribute.

Allow users to enter the info about one or the other...create the two objects depending on what the user chooses.

Here's the code from tonight's class (Baseball Players).

When creating classes....

MyBase.New() 'will access the parent classes constructor

Public Class BaseballPlayer
Inherits Player

'to create a BaseballPlayer from a Player class!

Here is the presentation...

Thursday, July 2, 2009

Code from today

LemoninfoTableAdapter.Insert(txtID.Text, txtLargeSold.Text, _
txtSmallSold.Text, txtName.Text)
Dim newRow As LemonadeStandDataSet.LemoninfoRow
newRow = LemonadeStandDataSet.Lemoninfo.NewLemoninfoRow
newRow.ID = txtID.Text
newRow.LargeSold = txtLargeSold.Text
newRow.SmallSold = txtSmallSold.Text
newRow.SalespersonName = txtName.Text
LemonadeStandDataSet.Lemoninfo.Rows.Add(newRow)

This above code is the most important from today!

Here are the two projects.

Tuesday, June 30, 2009

Database project

Here it is.

To determine prime number

Function determinePrime(ByVal x As Integer) As Boolean
For a = 2 To x / 2
If x Mod a = 0 Then
Return False
End If
Next
Return True
End Function

Serial Port Tutorial

Try this!

Lemonade

Click here for lemonade.zip.

Thursday, June 25, 2009

Today's code!

Click here for today's code.

Here is the code from mediafire.

OOP ** Four Questions! **

  1. What is object oriented programming?
  2. What is a class?
  3. What is an object?
  4. What is an attribute?

Tuesday, June 23, 2009

Code from the first class

Here are the projects from the first class.

First blog post

What do you hope to accomplish by the end of the course?

Next, copy sample code from the Console applications as well as from the GUI application that we created.

Miles per gallon program!

'Ask the user for the distance they travelled (in miles)
'ask the user how much gas they used (in gallons)
'calculate the miles per gallon and determine whether the
'driver is getting a good miles per gallon!

Some information about yourself!

To download Visual Basic Express

Click here.

david.freer@gmail.com

dfreer@mdc.edu

Saturday, June 6, 2009

Program

'read in a user's name. If the name is longer than 10 characters, tell
'the user their name is too long. Otherwise give them a friendly greeting!
'make a Function. Give it an appropriate name.

LoveTester Time

Create a LoveTester application!

On your blog...

I would like for you to define:
  • Sub routine
  • Function
  • Algorithm
  • Namespace
  • "My" as it relates to Visual Basic .NET

largest number function

Function largestNumber(ByVal num1 As Integer, ByVal num2 As Integer, ByVal num3 As Integer) As Integer
Dim largestNum = num1
If num2 > largestNum Then
largestNum = num2
End If
If num3 > largestNum Then
largestNum = num3
End If
Return largestNum
End Function

First assignment, third class

'make a sub routine that takes in a number and print out
'that number squared!

Saturday, May 30, 2009

Prime Number CODE

Module Module1
Sub Main()
'Dim y As Integer = 10
'While y > 0
' Console.WriteLine("Happy Birthday to you!")
' y = y - 1
'End While
'Dim x As Integer = 0
'While x < 100
' If x Mod 2 = 0 Then 'Mod keeps dividing until there is a remainder
' Console.WriteLine(x)
' End If
' x += 1
'End While
'Console.WriteLine("I have printed out all the " & _
' " even numbers less than 100")
'I want you to print out all the numbers from 5 to 5000
'counting by 5s!
'Count from 3333 to 3 by 3s, going backwards.
Dim counter1 As Integer = 1
Dim stop1 As Integer = 100
'For counter1 = 1 To stop1
' Console.Write("Hello!")
' For a As Integer = 1 To 1000
' Console.Write("Hello!!")
' Next
'Next
'A number is prime if it is only divisible by 1 and itself
'3,5,7...prime numbers never stop
'find out if a number is prime!
'have the user enter in a number..find out if it is a
'prime number ...hint***: You'll need the Mod operator
Dim boolVar1 As Boolean = True
'print out all the prime numbers up to 100!
'Console.WriteLine("Please enter a number")
'Dim numberEntered As Integer = Console.ReadLine
For firstCounter As Integer = 1 To 100
For a As Integer = 2 To (firstCounter / 2) + 1
If firstCounter Mod a = 0 Then
boolVar1 = False
End If
Next
If boolVar1 = True Then
Console.WriteLine(firstCounter & " is a prime number")
End If
boolVar1 = True
Next
Console.ReadLine()
End Sub
End Module

Saturday, May 16, 2009

What did I learn today?

The first VB.NET class I learned...

Here is the code from the first class.

Code from GUI NumberGuesser

Public Class Form1

Private Sub btnGuess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
Dim numberGuessed As Integer = txtNumber.Text
Dim luckyNumber As Integer = 77

If Math.Abs(luckyNumber - numberGuessed) < 10 Then
MsgBox("You are within 10!")
End If
End Sub
End Class

functions

Module Module1

Sub Main()
'do some procedural programming

'user enters a number and gets back the number squared
Console.WriteLine("Please enter a number")
Dim a As Integer = Console.ReadLine
Dim newNumber = a * a 'squared the number
Dim newNumber2 = a ^ 2
Dim newNumber3 = Math.Pow(a, 2)

Console.WriteLine(newNumber)
Console.WriteLine(newNumber2)
Console.WriteLine(newNumber3)


'ask the user for the side of a square. give the user back the perimeter and area.
Console.WriteLine("Please enter the side of a square:")
Dim sideOfSquare As Decimal = Console.ReadLine
Console.WriteLine("The area is " & calculateArea(sideOfSquare))
Console.WriteLine("The perimeter is " & calculatePerimeter(sideOfSquare))
Console.WriteLine("The area of a circle with a radius of 10 is " & calculateAreaOfCircle(10.0))

Console.ReadLine()
End Sub

Function calculatePerimeter(ByVal side As Decimal) As Decimal
Return side * 4
End Function

Function calculateArea(ByVal side As Decimal) As Decimal
Return side * side
End Function

'define a function that calculates the area of a circle given the radius!
Function calculateAreaOfCircle(ByVal radius As Decimal) As Decimal
'pi* r^2
Return Math.PI * (radius ^ 2)
End Function

End Module

Create a blog

  1. Go to www.blogger.com
  2. Create a blog, choose the name you want
  3. First post will be about:
    What is object oriented programming?
    What is a class?
    What is an object?
    What is an attribute?
  4. Publish your blog.
  5. Leave a comment on this blog with your URL!

First VB project

'you will ask the user for the distance they've driven in miles

'you will ask the user for the amount of gas they used

'give the user the miles per gallon of their vehicle!

Code from first example

Module Module1

Sub Main()
Console.WriteLine("Hello World!")
Console.WriteLine("Please enter your name:")
Dim userName As String = Console.ReadLine()
'declaring a variable to hold a String!
Console.WriteLine("Welcome " & userName & " we are glad you are here!")
Console.WriteLine("How many years have you lived?")
Dim ageOfUser As Integer = Console.ReadLine()
Dim userInEightYears As Integer = ageOfUser + 8
Console.WriteLine("In eight years you will be " & userInEightYears & " old")
Console.WriteLine("Someone half your age is " & ageOfUser / 2 & " years old")
Console.WriteLine("Someone twice your age is " & ageOfUser * 2 & " years old")
If ageOfUser > 10 Then
Console.WriteLine("The secret to life is do things you enjoy!")
Else
Console.WriteLine("You already know the secret!")
End If
Console.ReadLine()
'this is conditional logic
End Sub

End Module

Second assignment!

'Making a guessing game that asks the user for a number
'if the number is less than 10, tell them it is bad luck
'if the number is 12, tell them the number is okay
'if the number is 101, tell them they are great people for guessing such a number
'else say thanks for your time

Saturday, March 28, 2009

Project Discussion / Database review next Saturday!

If you are interested in one last class, we can meet here next Saturday at 2pm to discuss projects you are working on and database connectivity! Email me if you are interested:

david.freer@gmail.com

Visual Web Developer

http://www.microsoft.com/express/vwd/

Thursday, March 26, 2009

In class assignment :)

Keep track of
1. The number of hotdogs
2. The number of drinks
3. How many hotdogs sold
4. How many drinks sold
5. Total Revenue, Total Profit
6. Allow the cart to get more hotdogs and more drinks
7. Create your program so it has a pleasing look

Tuesday, March 24, 2009

Sum up the skills we learned today (Visual Basic Express!)

On your blog, recap what we have done today!

For "homework" design a simple screen for a bicycle store. Allow the users to get info about bikes!

catching errors!

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As Integer
Dim num1, num2 As Integer
'storage!
Try
num1 = txtNum1.Text
Catch ex As Exception
MsgBox("You have to enter a number!")
txtNum1.Text = ""
txtNum1.Focus() 'bring back the user to the location
End Try
Try
num2 = txtNum2.Text
Catch ex As Exception
MsgBox("You have to enter a number!")
txtNum2.Text = ""
txtNum2.Focus()
End Try
'convert String into Integer
result = num1 + num2
'calculation!
'input within the textboxes!
lblResult.Text = result
'output with the label!
End Sub
End Class

Code from today

Public Class Form1
Dim foodInfo(4) As String
'Cakes
'Bread
'Meat
'Seafood
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
foodInfo(0) = "Cakes at Publix are the highest quality!"
foodInfo(1) = "All the bread at Publix is fresh"
foodInfo(2) = "Publix meat is the best in the world"
foodInfo(3) = "Our seafood !! is caught freshly every day!"
If ComboBox1.Text = "Cakes" Then
'output info to lblInfo
lblInfo.Text = foodInfo(0)
ElseIf ComboBox1.Text = "Bread" Then
PictureBox1.ImageLocation = "http://upload.wikimedia.org/wikipedia/commons/1/1f/FD_1.jpg"
'PictureBox1.Visible = False
'PictureBox2.Visible = True
lblInfo.Text = foodInfo(1)
ElseIf ComboBox1.Text = "Meat" Then
lblInfo.Text = foodInfo(2)
ElseIf ComboBox1.Text = "Seafood" Then
lblInfo.Text = foodInfo(3)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
foodInfo(0) = "Cakes at Publix are the highest quality!"
foodInfo(1) = "All the bread at Publix is fresh"
foodInfo(2) = "Publix meat is the best in the world"
foodInfo(3) = "Our seafood !! is caught freshly every day!"
If txtProduct.Text = "Cake" Then
lblInfo.Text = foodInfo(0)
ElseIf txtProduct.Text = "Bread" Then
lblInfo.Text = foodInfo(1)
End If
End Sub
End Class

Thursday, March 19, 2009

Code for Lemonade Stand

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim costOfCup As Decimal = 1.15
Dim largeCup As Decimal = 1.75
Dim totalCost As Decimal = 0.0
If CheckBox1.Checked = True Then
totalCost = largeCup * txtCups.Text
Else
totalCost = costOfCup * txtCups.Text
End If
lblPrice.Text = totalCost
End Sub
End Class

---
Give a description of what this code does:
....

Welcome Visual Basic Express Students!

For your first post I would like you to summarize the things you have learned so far...

Saturday, March 14, 2009

Please finish your Vehicle, Truck, and Car example

Your "homework" is to finish your Vehicle, Truck and Car example if you didn't in class.

Also read Chapter 11 in your book as we will be covering database connectivity in the next class.

Create a presentation using PowerPoint...

CLR, .NET Framework, History of Visual Basic, ASP .NET, C#, XML

Saturday, February 28, 2009

Here is the code!

Click here to see one way of parsing data:

Apple .99
Pie 2.50
Cookie .99
Tea 1.25

Today's first exercise!

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

Saturday, February 21, 2009

Last class

  1. Make a Console application that asks for a user's name and gives them a happy message in return while using their name. "&"
  2. Depending on the first letter of their name give two different messages. subString and if statements.
  3. Ask for an age. If the age is greater than 70 and their first name starts with "E" give them a separate funny message.
  4. Students will make an application to figure out the Horroscope. Users will pick their signs and get a message based on their future.
    Use quotation marks in their output.
    Add NumericUpDown.
    Read in Name and output it.
  5. Ask for a number 1 to 100. Tell the user if it's in the 1st quarter, 2nd quarter, 3rd quarter, or 4th quarter.
  6. Create a BankAccount class. Here are some possible attributes (fields):
    Balance, owner, day, status, social security number.
    View the information that was entered in!

Saturday, February 7, 2009

February 7th, 2009

  • Add 2+5
  • Take in two numbers and add them. Multiply them and give both results.
  • Use a subroutine to determine if a number is Prime. Post the code to your blog!
  • Think of a project that you would be interested in creating with VB.NET. Write on your blog possible users, input, output.

Saturday, January 31, 2009

Code for triangle numbers and their factors!!!

Module Module1
Sub Main()
Dim counter As Integer
'add another variable!
Dim diff As Integer = 1
Dim totalFactors As Integer = 0
Dim factorCounter As Integer
For counter = 1 To 60000
'Console.WriteLine(counter)
For factorCounter = 1 To counter
If counter Mod factorCounter = 0 Then
totalFactors = totalFactors + 1
End If
Next
If totalFactors > 50 Then
Console.WriteLine(counter)
End If
counter = counter + diff
diff = diff + 1
totalFactors = 0
Next

'1, 3, 6, 10, 15, 21, 28
'print out the first 10 triangle numbers!
Console.ReadLine()
End Sub
End Module

On your blog...

Please explain...

  • What an if statement is and what it is used for.
  • What a loop is and what it is used for.

Put a code example on your blog. What is the syntax for each!

Saturday, January 24, 2009

First code in VB .NET!

Module Module1
Sub Main()
'to make a variable ... Dim variable1 As
'Console write line!
'Console read line!
'This is a comment. You use comments so other programmers
'can know what you mean!!
'Miles Per Gallon Calculator!
Dim miles As Decimal
Dim gallons As Decimal
Dim mpg As Decimal
Console.WriteLine("Please enter the distance in miles:")
miles = Console.ReadLine
Console.WriteLine("Please enter the gallons used:")
gallons = Console.ReadLine
' We need to calculate the miles per gallon!
mpg = miles / gallons
Console.WriteLine(mpg)
'Console.ReadLine()
'to see if we have the correct information
'100 miles / 10 gallons of gas -> 10 mpg
End Sub
End Module

We are going to work on a MPG program next!

It will be fun!

A great site to learn about OO Programming Using VB

Great site to learn about OO using VB!

http://www.codeproject.com/KB/vb/OOPS_In_VBNET.aspx

What are possible attributes and methods for a Lemonade Stand?

On a blog,

http://www.blogger.com/

I'd like you to list the possible attributes and methods for a Lemonade stand.

When you are finished with your blog, I'd like you to email me the URL.

You may work with someone next to you!

I'd also like you to include the data type for your attributes:

http://www.ondotnet.com/pub/a/dotnet/2001/07/30/vb7.html

DF

OO Programming!

http://mdcvb.blogspot.com/2008/09/object-oriented-programming_13.html

Key words RESERVED!!

http://mdcvb.blogspot.com/2008/09/object-oriented-programming.html

Email

  1. What's your name?
  2. What sort of programming experience do you have?
  3. What are you interested in getting out of this class?
  4. Is this class for your job or personal reasons?

david.freer@gmail.com

Welcome to class!

I look forward to a great semester!