VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

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

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




lab database

 

lab database, can u solved my problem

ankiesiau

23 May, 2009 - 02:10 AM
Post #1

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

I am using visual basic 2008 express edition.I got some error message.
Can anyone solved my problem.

Error 1 Name 'numcourses' is not declared.what is means?


CODE
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If [b]numcourses[/b] >= 8 Then
            MsgBox("You are only allowed to enter 8 classes", , "Error")
            Exit Sub


This post has been edited by ankiesiau: 23 May, 2009 - 02:15 AM

User is offlineProfile CardPM
+Quote Post


firebolt

RE: Lab Database

23 May, 2009 - 03:07 AM
Post #2

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,462



Thanked: 75 times
Dream Kudos: 1675
My Contributions
VB2008 => VB.NET.
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: Lab Database

23 May, 2009 - 03:47 AM
Post #3

Dyslexics Untie!
Group Icon

Joined: 26 Jul, 2007
Posts: 14,701



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

My Contributions
Moved to VB.NET smile.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: Lab Database

23 May, 2009 - 04:23 AM
Post #4

Dyslexics Untie!
Group Icon

Joined: 26 Jul, 2007
Posts: 14,701



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

My Contributions
That's a simple one, it's saying that numcourses hasn't been declared. Show us where you've declared this variable.

Also, you're using VB.NET now, stop using MsgBox and start using the MessageBox Class. MsgBox is a legacy items left over from the VB6 days smile.gif
User is offlineProfile CardPM
+Quote Post

searockruz

RE: Lab Database

23 May, 2009 - 04:26 AM
Post #5

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
have you declared numcourses as integer

Dim numcourses is Integer

i suggest you learn basic of vb.net
User is offlineProfile CardPM
+Quote Post

TechWar

RE: Lab Database

23 May, 2009 - 11:15 AM
Post #6

D.I.C Regular
***

Joined: 17 Feb, 2009
Posts: 468



Thanked: 7 times
My Contributions
QUOTE(searockruz @ 23 May, 2009 - 04:26 AM) *

have you declared numcourses as integer

Dim numcourses is Integer

i suggest you learn basic of vb.net

You might mean as.
so be a little nicer

anyway, yeah, I still catch myself using msgbox crazy.gif biggrin.gif
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: Lab Database

23 May, 2009 - 07:32 PM
Post #7

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(PsychoCoder @ 23 May, 2009 - 04:23 AM) *

That's a simple one, it's saying that numcourses hasn't been declared. Show us where you've declared this variable.

Also, you're using VB.NET now, stop using MsgBox and start using the MessageBox Class. MsgBox is a legacy items left over from the VB6 days smile.gif


CODE
Dim [b]k[/b] As Integer
        Dim [b]temp[/b] As String
        ReDim Preserve students(arraysize).courses(numcourses)
        If numcourses = 0 Then
            'redim students(arraysize).courses(0)
            ListBox1.Items.Clear()

User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: Lab Database

23 May, 2009 - 07:59 PM
Post #8

Dyslexics Untie!
Group Icon

Joined: 26 Jul, 2007
Posts: 14,701



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

My Contributions
I see you declaring k and temp, where are you declaring numcourses?
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: Lab Database

23 May, 2009 - 09:30 PM
Post #9

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(PsychoCoder @ 23 May, 2009 - 07:59 PM) *

I see you declaring k and temp, where are you declaring numcourses?



[code]Dim k As Integer
Dim temp As String
ReDim Preserve students(arraysize).courses(numcourses)
If numcourses = 0 Then
'redim students(arraysize).courses(0)
ListBox1.Items.Clear()
End If
students(arraysize).first = UCase(TextBox1.Text)
students(arraysize).last = UCase(TextBox2.Text)
students(arraysize).semester = UCase(TextBox3.Text)
students(arraysize).HSgradyear = UCase(TextBox4.Text)
students(arraysize).IDnumber = UCase(TextBox5.Text)
students(arraysize).courses(numcourses).coursenumber = UCase(TextBox6.Text)
students(arraysize).courses(numcourses).instructor = UCase(TextBox7.Text)

temp = Str(numcourses + 1) & ") " & students(arraysize).courses(numcourses).coursenumber & " " & students(arraysize).courses(numcourses).instructor
'ListBox1.Items.Add("ID#: " & "" & students(arraysize).IDnumber)
ListBox1.Items.Add(temp)
numcourses = numcourses + 1
'TextBox1.Text = ""
'TextBox2.Text = ""
'TextBox3.Text = ""
'TextBox4.Text = ""
'TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox7.Focus()[code]

User is offlineProfile CardPM
+Quote Post

Damage

RE: Lab Database

23 May, 2009 - 09:39 PM
Post #10

D.I.C Addict
Group Icon

Joined: 5 Jun, 2008
Posts: 975



Thanked: 14 times
Dream Kudos: 75
My Contributions
QUOTE(ankiesiau @ 23 May, 2009 - 09:30 PM) *



CODE

Dim k As Integer
        Dim temp As String
        ReDim Preserve students(arraysize).courses(numcourses)
        If numcourses = 0 Then
            'redim students(arraysize).courses(0)
            ListBox1.Items.Clear()
        End If





see your declaring k as an integer and temp as a string but you don't appear to be declaring numcourses as anything before you use it




User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 03:24PM

Live VB.NET Help!

Be Social

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

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month