• 0

need some help


Question

ok been tryen to teach my self vb6.0 and got a prob

i have 1 book to go on Programming In Visual Basic 6.0 By Julia Case Bradley * Anita C Millspaugh(ya i'me poor)

so hears my prob i need the input of txtboxes to be numeric (isnumeric) but cant get it to work

and in another cmdbutton (called mnuDOL) to displat a msgbox if 1 variable is larger than another

and if it is smaller than display another msgbox

Note when i code i misspell alot (for some reason happens alot when i code don't know y)

and been teaching myself for only a month so have mercy :)

-------------------------------------------------------------------------------

Dim curhourstotal As Currency

Dim curTotalPiece As Currency

Private Sub cmdCalculate_Click()

Dim snghoursworked As Single

Dim curhoursworked As Currency

curhoursworked = 5.15

Dim curPreps As Currency

Dim curInteriors As Currency

Dim cur3andFinal As Currency

Dim curClay As Currency

Dim curCut As Currency

Dim curWVWT As Currency

Dim curSpot As Currency

Dim curtax As Currency

Dim curtaxshow As Currency

Dim curtotal As Currency

Dim curtotalshow As Currency

Dim curfreshup As Currency

Dim curfui As Currency

Dim intquantity1 As Integer

Dim intquantity2 As Integer

Dim intquantity3 As Integer

Dim intquantity4 As Integer

Dim intquantity5 As Integer

Dim intquantity6 As Integer

Dim intquantity7 As Integer

Dim intquantity8 As Integer

Dim intquantity9 As Integer

Dim curawncer As Currency

Dim curawmcer2 As Currency

Dim curawncer3 As Currency

Dim curawncer4 As Currency

Dim curawncer5 As Currency

Dim curawncer6 As Currency

Dim curawncer7 As Currency

Dim curawncer8 As Currency

Dim curawncer9 As Currency

curtax = 0.22

curPreps = 7.5

curInteriors = 15#

cur3andFinal = 20#

curClay = 20#

curCut = 20#

curWVWT = 7#

curSpot = 3#

curfui = 7#

curfreshup = 20#

intquantity1 = Val(txtPreps.Text)

intquantity2 = Val(txtInteriors.Text)

intquantity3 = Val(txt3andFinal.Text)

intquantity4 = Val(txtClay.Text)

intquantity5 = Val(txtCut.Text)

intquantity6 = Val(txtWVWT.Text)

intquantity7 = Val(txtSpot.Text)

intquantity8 = Val(txtFreshUp.Text)

intquantity9 = Val(txtFUI.Text)

snghoursworked = Val(txtHoursWorked.Text)

If txtPreps.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "Missing Data"

txtPreps.SetFocus

ElseIf txtInteriors.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "Missing Data"

txtInteriors.SetFocus

ElseIf txt3andFinal.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "Missing Data"

txt3andFinal.SetFocus

ElseIf txtCut.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "Missing Data"

txtCut.SetFocus

ElseIf txtClay.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "Missing Data"

txtClay.SetFocus

ElseIf txtWVWT.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "Missing Data"

txtWVWT.SetFocus

ElseIf txtSpot.Text = "" Then

MsgBox "please fill out all data", vbOKOnly, "missing data"

txtSpot.SetFocus

ElseIf txtHoursWorked = "" Then

MsgBox "please fill out all data", vbOKOnly, "missing data"

txtHoursWorked.SetFocus

ElseIf txtFreshUp = "" Then

MsgBox "please fill out all data", vbOKOnly, "missing data"

txtFreshUp.SetFocus

ElseIf txtFUI = "" Then

MsgBox "please fill out all data", vbOKOnly, "missing data"

txtFUI.SetFocus

Else

curawncer = curPreps * txtPreps.Text

curawncer2 = curInteriors * txtInteriors.Text

curawncer3 = cur3andFinal * txt3andFinal.Text

curawncer4 = curClay * txtClay.Text

curawncer5 = curCut * txtCut.Text

curawncer6 = curWVWT * txtWVWT.Text

curawncer7 = curSpot * txtSpot.Text

curawncer8 = curfreshup * txtFreshUp.Text

curawncer9 = curfui * txtFUI.Text

curtotalpieces = curawncer + curawncer2 + curawncer3 + curawncer4 + curawncer5 + curawncer6 + curawncer7 + curawncer8 + curawncer9

lblGross.Caption = FormatCurrency(curtotalpieces)

curtaxshow = curtotalpieces * curtax

lblNet.Caption = FormatCurrency(curtaxshow)

curtotalshow = curtotalpieces - curtaxshow

lblTotal.Caption = FormatCurrency(curtotalshow)

curhourstotal = curhoursworked * snghoursworked

lblMinHours.Caption = FormatCurrency(curhourstotal)

End If

End Sub

Private Sub cmdclear_Click()

txtPreps.Text = ""

txtInteriors.Text = ""

txt3andFinal.Text = ""

txtCut.Text = ""

txtClay.Text = ""

txtWVWT.Text = ""

txtSpot.Text = ""

txtHoursWorked = ""

lblMinHours.Caption = ""

lblNet.Caption = ""

lblTotal.Caption = ""

lblGross.Caption = ""

txtFreshUp.Text = ""

txtFUI.Text = ""

txtPreps.SetFocus

End Sub

Private Sub mnuabout_Click()

MsgBox "BUILT 1.1.00 BY PARADOXDREAM", vbOKOnly, "ABOUT"

End Sub

Private Sub mnudol_Click()

If curtotalpieces < curhourstotal Then

MsgBox "CALL THE D.O.L", vbInformation, "GOT RIPED"

Else

MsgBox "NO NEED TO CALL THE D.O.L.", vbOKOnly, "CONGRATS"

End If

End Sub

Private Sub mnuexit_Click()

End

End Sub

Private Sub mnuhide_Click()

Image1.Visible = False

Image2.Visible = False

Image3.Visible = False

End Sub

Private Sub mnuPrint_Click()

PrintForm

End Sub

Private Sub mnushow_Click()

Image1.Visible = True

Image2.Visible = True

Image3.Visible = True

End Sub

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

IsNumeric() doesnt work because youre not using it anywhere ...... and IsNumeric doesnt give you a numeric value, it only tells you if the contents of the text box can be evaluated as a numeral

so

is input a number = InNumeric(Text1.Text) = true/false

conditions: IsNumeric returns false if there is any non-numeric character; returns true otherwise.

So, If IsNumeric(Text1.Text) = True Then -> do whatever you need to do <- Else -> You need to remove the non-numeric data from the text box <-

also,

curawncer5 = curCut * txtCut.Text

should be

curawncer5 = curCut * ccur(txtCut.Text)

so that you dont get an error about data types

Link to comment
Share on other sites

  • 0

and just so you know, your avatar link to

http://www.techimage.net/getimg.php?img=whitemagic%20(Custom)4.jpg

had downloaded over 5MB before i stopped it..... you better change that image..............

Link to comment
Share on other sites

  • 0

thx verry much

i did use the isnumeric but wasn't worken right so i took it out and came hear to find some good help

and i took out that url

do you know if the book i'me usen is any good or you can suggest a better one?

Link to comment
Share on other sites

  • 0

Yes, a VB.NET book :p I like 'Programming Microsoft Visual Basic .NET Core Reference'

Seriously though, VB6 is so 20th century.

Also, can't you use arrays?

Dim intquantity1 As Integer

Dim intquantity2 As Integer

Dim intquantity3 As Integer

Dim intquantity4 As Integer

Dim intquantity5 As Integer

Dim intquantity6 As Integer

Dim intquantity7 As Integer

Dim intquantity8 As Integer

Dim intquantity9 As Integer

turn it all into:

Dim intquantity(9) As Integer

Link to comment
Share on other sites

  • 0

just what i was going to say, dayon. although, in this case it would be

Dim intquantity(1 to 9) As Integer

Link to comment
Share on other sites

  • 0

"Seriously though, VB6 is so 20th century"

so what language would be better?

i have ms visual studio enterprise 6.0

to honest i started vb6 because it seamed kinda easy and i thought that it would give me a better understanding of c/c++

but at the same time i don't want to waist my time learning something that is dead!!

so what would you do???

Link to comment
Share on other sites

  • 0
Grab a copy of SharpDevelop, and try out VB.NET

I got VB.net, very easy to use (Because I am very new to programming), but I never seen VB6 :blink: :rolleyes: :happy: :wacko: :no:

Link to comment
Share on other sites

  • 0
to honest i started vb6 because it seamed kinda easy and i thought that it would give me a better understanding of c/c++

VB6 and C/C++ are very different beasts. The syntax is very different and not to mention you have to get used to pointers in C/C++.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.