When posting code, please use code tags; that way indentations are maintained which will make it easier to read.
Type
[code], paste your code after that and type
[/code] at the end of your code
Code:
Public Class Form1
Dim Qty As Integer
Dim QtyPrice As Decimal
Dim SubTotal As Decimal
Const TaxRate As Decimal = 0.07
Dim TaxAmount As Decimal
Dim OrderTot As Decimal
Dim TotItems As Integer
Dim DailyTot As Decimal
Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
CustName.Text = ""
Address.Text = ""
City.Text = ""
State.Text = ""
Zip.Text = ""
Item.Text = ""
Quantity.Text = ""
Price.Text = ""
SubTot.Text = ""
SalesTax.Text = ""
OrderTotal.Text = ""
GroupBox1.Visible = False
End Sub
Private Sub CustName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustName.TextChanged
If CustName.Text <> "" And Address.Text <> "" And City.Text <> "" And State.Text <> "" And Zip.Text <> "" Then
GroupBox1.Visible = True
End If
End Sub
Private Sub Address_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Address.TextChanged
If CustName.Text <> "" And Address.Text <> "" And City.Text <> "" And State.Text <> "" And Zip.Text <> "" Then
GroupBox1.Visible = True
End If
End Sub
Private Sub City_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles City.TextChanged
If CustName.Text <> "" And Address.Text <> "" And City.Text <> "" And State.Text <> "" And Zip.Text <> "" Then
GroupBox1.Visible = True
End If
End Sub
Private Sub State_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles State.TextChanged
If CustName.Text <> "" And Address.Text <> "" And City.Text <> "" And State.Text <> "" And Zip.Text <> "" Then
GroupBox1.Visible = True
End If
End Sub
Private Sub Zip_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Zip.TextChanged
If CustName.Text <> "" And Address.Text <> "" And City.Text <> "" And State.Text <> "" And Zip.Text <> "" Then
GroupBox1.Visible = True
End If
End Sub
Private Sub CalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CalcButton.Click
Qty = Integer.Parse(Quantity.Text)
QtyPrice = Integer.Parse(Price.Text)
SubTotal = Qty * QtyPrice
SubTot.Text = SubTotal.ToString
TaxAmount = TaxRate * SubTotal
SalesTax.Text = TaxAmount.ToString
OrderTot = TaxAmount + SubTotal
OrderTotal.Text = OrderTot.ToString
End Sub
End Class
I'm not a VB coder (ages ago that I did something in VBA)
Based on this piece of code
Code:
Private Sub State_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles State.TextChanged
If CustName.Text <> "" And Address.Text <> "" And City.Text <> "" And State.Text <> "" And Zip.Text <> "" Then
GroupBox1.Visible = True
End If
End Sub
I would make something like
Code:
Private Sub Quantity_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Quantity.TextChanged
Qty = Integer.Parse(Quantity.Text)
If Qty > 0 And Qty <= 5 Then
' update the item price here
Price.Text = "5"
End If
If Qty > 5 And Qty <= 50 Then
' update the item price here
Price.Text = "3"
End If
End Sub
Not the most perfect code but it shows the idea.
Not sure if VB understand '<=' (less than or equal) and also not sure how to use 'else' in VB.