Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > VB Classic

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 11-01-2009, 11:37 PM
Drew_gable Drew_gable is offline
Registered User
 
Join Date: Sep 2004
Location: Northampton,United Kingdom
Posts: 219
Sting or Long? not sure advice please

Hi,

can someone please check the below for me and let me know if I am using the right data types


at the moment I have them like this

Public ValueTendered As String
Public TotalTendered As String

should they be

Public ValueTendered As Long
Public TotalTendered As Long

They are numbers (part of a tender tracking module for the cash drawer)

This is the code I am calling when ever a tender is done

If Val(TotalTendered) >= Val(SubTotalValue) Then Call ModuleFunction

If Val(TotalTendered) < Val(SubTotalValue) Then
TotalToPay = SubTotalValue - TotalTendered
TotalToPay = Format(TotalToPay, "######0.00")
FrmTenderScreen.LabUserMessages.Alignment = 0
FrmTenderScreen.LabUserMessages.Alignment = 0
FrmTenderScreen.LabUserMessages.Caption = " TENDERED " & DisplayTender & TotalTendered & vbNewLine & " TO PAY " & DisplayTender & TotalToPay
Call TotalToPayment

If FrmTenderScreen.Visible = True Then
FrmTenderScreen.Enabled = True
FrmTenderScreen.SetFocus
End If

If FrmDepositScreen.Visible = True Then
FrmDepositScreen.Enabled = True
FrmDepositScreen.SetFocus
End If
End If

It works every time with cash payments and gift cards but if you mix a credit card payment it does not work.

I have to enter 0 CASH about 5-10 times before it will function and end the transacation.

And in a EPoS software this is not a good thing.

I would welcome any advice, commets you guys can give me

Thanks
__________________
Drew

EPoS made simple
www.jasonpos.co.uk | www.jasonpos.com
Reply With Quote
  #2  
Old 11-02-2009, 08:36 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Numbers should be a numeric data type:

Integer
Long
Double
Single

Which one depends on how large a number will be stored in the variable.

Alpha characters should be a string.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 11-02-2009, 02:12 PM
Drew_gable Drew_gable is offline
Registered User
 
Join Date: Sep 2004
Location: Northampton,United Kingdom
Posts: 219
The max it will hold is 999999.99

would taht be long or Interger?
__________________
Drew

EPoS made simple
www.jasonpos.co.uk | www.jasonpos.com
Reply With Quote
  #4  
Old 11-02-2009, 02:27 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Yes, that would be too much for an Integer.

Integer = 16 bit number ranging from -32,768 to 32,768

Long = 32 bit number ranging from -2,147,483,648 to 2,147,483,648

Single = 32-bit number ranging from -3.402823e38 to -1.401298e-45 for negative values and from 1.401298e-45 to 3.402823e38 for positive values. When you need fractional numbers within this range, this is the data type to use.

Double = 64-bit floating point number used when high accuracy is needed. These variables can range from -1.79769313486232e308 to -4.94065645841247e-324 for negative values and from 4.94065645841247e-324 to 1.79769313486232e308 for positive values.

I would think a Long would be the data type you would need for this particular instance.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Search System Tray MyPlague .NET 2 03-20-2006 06:18 PM
AnimateWindow API Tim Manos VB Classic 4 10-19-2001 07:06 AM
How do I detect an FTP timeout? Julian Milano VB Classic 2 08-11-2000 01:11 PM
How do I detect an FTP timeout? Julian Milano VB Classic 0 08-10-2000 10:16 PM
Trying to print a PDF File from VB Kunal Sharma VB Classic 2 04-25-2000 04:45 PM


All times are GMT -4. The time now is 11:02 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.