Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,545 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,568 people online right now. Registration is fast and FREE... Join Now!




Structured Exception Handling Errors

 
Reply to this topicStart new topic

Structured Exception Handling Errors, Structured Exception Handling Errors

libby50
27 Nov, 2007 - 04:33 PM
Post #1

New D.I.C Head
*

Joined: 8 Nov, 2007
Posts: 15


My Contributions
I keep getting a bunch of errors...and not understanding...why...Any help would be much appreciated....Thanks

CODE

' Project name:         College Course Project
' Project purpose:      Displays information about a college course.
' Created/revised by:   <your name> on <current date>

Option Explicit On
Option Strict On

Public Class MainForm
    ' declare all application objects
    Private aCourse As Course
    Private aSection As Section
    Private anInstructor As Instructor
    Private aStudent As Student

    Private Sub MainForm_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load

        ' instantiate objects when form loads using default values
        aCourse = New Course
        aSection = New Section
        anInstructor = New Instructor
        aStudent = New Student
    End Sub

    Private Sub displayButton_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles displayButton.Click
        'declare variables
        Dim quotient As Decimal
        Dim dividend As Decimal
        Dim divisor As Decimal

        Try
            ' input
            dividend = Convert.ToDecimal(dividendTextBox.Text())
            divisor = Convert.ToDecimal(divisorTextBox.Text())
            ' processing
            quotient = dividend / divisor

            'output
            quotientLabel.Text = Convert.ToString(quotient)
            errorLabel.Text = ""
        Catch
            errorLabel.Text = "Please enter the correct values"
        Finally
            MessageBox.Show(Me, "Ready for more input", "Ready")
        End Try



        ' get data from form, set instance variables for objects
        aCourse.CourseId = courseIdTextBox.Text
        aCourse.CourseDept = courseDeptListBox.Text
        aCourse.CourseNum = Convert.ToInt16(courseNumTextBox.Text)
        aCourse.CreditHours = Convert.ToInt16(courseCreditTextBox.Text)
        aCourse.Section = aSection

        aSection.SectionNum = Convert.ToInt16(secNumTextBox.Text)
        aSection.Semester = secSemesterListBox.Text
        aSection.SchoolYear = Convert.ToInt16(secYearTextBox.Text)
        aSection.DayAndTime = secDayTimeTextBox.Text
        aSection.Instructor = anInstructor
        aSection.Student = aStudent

        anInstructor.InstructorId = instructorIdTextBox.Text
        anInstructor.InstructorTitle = instructorTitleListBox.Text
        anInstructor.InstructorName = instructorNameTextBox.Text
        anInstructor.InstructorRank = instructorRankListBox.Text

        aStudent.StudentId = studentIdTextBox.Text
        aStudent.StudentName = studentNameTextBox.Text
        aStudent.StudentClass = studentClassListBox.Text

        ' display all course information
        MessageBox.Show(aCourse.ToString(), _
            "College Course Information", _
            MessageBoxButtons.OK, MessageBoxIcon.Information)

    End Sub

    Private Sub exitButton_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles exitButton.Click
        Me.Close()
    End Sub
End Class

User is offlineProfile CardPM
+Quote Post

Jayman
RE: Structured Exception Handling Errors
27 Nov, 2007 - 07:31 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,303



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Moved to VB.NET forum. Please post your topics in the correct forum.

It would be helpful if you post the error messages that you are getting. We are not mind readers after all, we are programmers.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Structured Exception Handling Errors
28 Nov, 2007 - 05:13 AM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,482



Thanked: 161 times
Dream Kudos: 9050
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Yeah we really need to know what errors you're receiving
User is online!Profile CardPM
+Quote Post

libby50
RE: Structured Exception Handling Errors
28 Nov, 2007 - 08:35 AM
Post #4

New D.I.C Head
*

Joined: 8 Nov, 2007
Posts: 15


My Contributions
QUOTE(PsychoCoder @ 28 Nov, 2007 - 06:13 AM) *

Yeah we really need to know what errors you're receiving



I am sorry. here there are...I followed the example in my book, but still not right....Thank you


Error 3 Name 'quotientLabel' is not declared.
Error 4 Name 'errorLabel' is not declared.
Error 5 Name 'errorLabel' is not declared.
Error 2 Name 'divisorTextBox' is not declared.
Error 1 Name 'dividendTextBox' is not declared.
User is offlineProfile CardPM
+Quote Post

ferrari12508
RE: Structured Exception Handling Errors
28 Nov, 2007 - 07:14 PM
Post #5

D.I.C Lover
Group Icon

Joined: 2 Nov, 2007
Posts: 1,112



Thanked: 2 times
Dream Kudos: 150
My Contributions
it looks to me like errorlabel is a label in your forms design, therefore it wouldnt work the same way as a variable and if that doesnt help, are you sure you have the correct name?
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Structured Exception Handling Errors
28 Nov, 2007 - 08:22 PM
Post #6

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,303



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Did you create the controls in the designer with those names or did you name them something else?
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Structured Exception Handling Errors
28 Nov, 2007 - 08:56 PM
Post #7

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,482



Thanked: 161 times
Dream Kudos: 9050
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Like the other 3 have said; Did you copy the code from your book then build your UI on your own without naming the controls what they were in the code the book provided? If so, then find the controls in question and rename them, or you can also rename the control names being referenced in the code
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:32PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month