Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > New to VB....probably a stupid question


Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2003, 10:06 PM
bellaLANA bellaLANA is offline
Newcomer
 
Join Date: May 2003
Posts: 6
Unhappy New to VB....probably a stupid question


Hey....this is probably a really stupid question but i was wandering if anyone could tell me what the message "Type Mismatch" means ... and why it highlights this line when it gives me the error...

g_dPriceArray(iCounter) = Field(sLine, ",", 2)

please....if someone could help that would be great!
Reply With Quote
  #2  
Old 05-15-2003, 10:18 PM
ViSioN's Avatar
ViSioN ViSioN is offline
Centurion
 
Join Date: Apr 2003
Location: Ontario, Canada
Posts: 136
Default

It means you declared the variable wrong.. ie. its an integer and you declared it as a string. i cant tell you precisely which variable you declred wrong without seeing where you declared your variables.. but thats where you went wrong.

edit: Hope this helps
__________________
(Please correct me if I'm wrong.. I'm dumb)
Reply With Quote
  #3  
Old 05-15-2003, 10:21 PM
bellaLANA bellaLANA is offline
Newcomer
 
Join Date: May 2003
Posts: 6
Default

Hey Vision, thanks, here are my declarations....i don't understand what i have done wrong...

'Global Declarations
Global Const g_iUpperIndex As Integer = 100

'Declare global arrays
Public g_sTitleArray(g_iUpperIndex) As String
Public g_dPriceArray(g_iUpperIndex) As Double
Public g_sCategoryArray(g_iUpperIndex) As String
Public g_dQuantityArray(g_iUpperIndex) As Double
Reply With Quote
  #4  
Old 05-15-2003, 10:30 PM
ViSioN's Avatar
ViSioN ViSioN is offline
Centurion
 
Join Date: Apr 2003
Location: Ontario, Canada
Posts: 136
Default

im sorry.. i dont see anything noticably wrong with that. im also a newbie so im unfamiliar with the use of 'Public' as a declaration and Global Const. When I paste those into vb i get like, half a dozen different errors and couldnt figure it out.. someone else will have to help you.. sorry again

another possibility is sLine and iCounter could be declared wrong. you didnt post where you declared them... other than that, i have no more ideas
__________________
(Please correct me if I'm wrong.. I'm dumb)
Reply With Quote
  #5  
Old 05-15-2003, 10:32 PM
bellaLANA bellaLANA is offline
Newcomer
 
Join Date: May 2003
Posts: 6
Default

No worries ViSiOn...Thanks for ur help anyways! I'm just soooooooo lost when it comes to programming hehe
Reply With Quote
  #6  
Old 05-15-2003, 10:44 PM
starbitz's Avatar
starbitz starbitz is offline
Junior Contributor
 
Join Date: Feb 2003
Location: Philippines
Posts: 336
Default

Quote:
Originally Posted by bellaLANA
No worries ViSiOn...Thanks for ur help anyways! I'm just soooooooo lost when it comes to programming hehe


Your g_dPriceArray(iCounter) expects a Double type value and your Field(sLine, ",", 2) is not returning that type. That's why you get type mismatch error. What are you expecting to get from Field(sLine, ",",2) by the way?
__________________
"Everything should be made as simple as possible, but not simpler."
- Albert Einstein
Reply With Quote
  #7  
Old 05-15-2003, 10:56 PM
bellaLANA bellaLANA is offline
Newcomer
 
Join Date: May 2003
Posts: 6
Default

to tell u the truth i have got no idea! i copied this from a case study we did....and it worked...but now that i am trying it in my assignment, it doesn't. It is supposed to store the second field into the price array.
Sorry i don;t even know if i am making sense here...
Reply With Quote
  #8  
Old 05-16-2003, 12:21 AM
VBJoe's Avatar
VBJoe VBJoe is offline
Village VB Idiot

* Expert *
 
Join Date: Jan 2003
Location: Idaho
Posts: 1,850
Default

Where is the Field function declared? Is it located in a Module in your project? I couldn't find it in my object browser.
Reply With Quote
  #9  
Old 05-16-2003, 09:56 PM
bellaLANA bellaLANA is offline
Newcomer
 
Join Date: May 2003
Posts: 6
Default

the declaration for the Field function is in another module in the project...
Reply With Quote
  #10  
Old 05-16-2003, 10:05 PM
starbitz's Avatar
starbitz starbitz is offline
Junior Contributor
 
Join Date: Feb 2003
Location: Philippines
Posts: 336
Default

Quote:
Originally Posted by bellaLANA
the declaration for the Field function is in another module in the project...


Have you checked also what type it will return? It is supposed to return Double type inorder for you not get the type mismatch error. If it is declared with diffirent return type, then either you need to change that or the type of your Public g_dPriceArray(g_iUpperIndex)
__________________
"Everything should be made as simple as possible, but not simpler."
- Albert Einstein
Reply With Quote
  #11  
Old 05-16-2003, 10:24 PM
bellaLANA bellaLANA is offline
Newcomer
 
Join Date: May 2003
Posts: 6
Default

ahhhhhhhhh this is really shi**ing me! lol

the Public g_dPriceArray(g_iUpperIndex) as Double -- is how it is declared in the Field sub

then in another module it is..

Public g_dPriceArray(iCounter) = Field....bla bla

i am sooooooooooooooooo lost!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Parameters VB to Access (also ISAM question) udo Database and Reporting 6 11-05-2002 08:00 PM
VB question from newbie sunbin General 26 09-19-2002 01:07 AM
QB to VB Conversion - By AIO BillSoo Tutors' Corner 0 08-06-2002 11:37 AM
Stupid question from a VB newbie Nodyce Tech Discussions 10 02-20-2002 07:24 PM
vb or not vb, that is the question cornbread General 2 11-14-2001 02:54 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->