Question:
Help With my Visual Basic Code plz! There are syntax errors, help?
anotherteen26
2010-11-03 19:47:43 UTC
Option Explicit On
Public Class AggieVideo

Const DISCOUNT_Decimal As Decimal = 10D
Const NEW_DVD_Decimal As Decimal = 3D
Const NEW_VHS_Decimal As Decimal = 2D
Const DVD_Decimal As Decimal = 2.5D
Const VHS_Decimal As Decimal = 1.8D
Friend AmountDueDecimal, TotalCustAmtDueDecimal As Decimal
Friend TotalCustomersInteger As Integer

Private Function RentalFee As Decimal

Dim PriceDecimal As Decimal

'ENTER REMARK HERE
If NewReleaseBoolean = True And DVDBoolean = True Then
PriceDecimal = NEW_DVD_Decimal
ElseIf VHSBoolean = True Then
PriceDecimal = NEW_VHS_Decimal
ElseIf DVDBoolean = True Then
PriceDecimal = DVD_Decimal
ElseIf VHSBoolean = True Then
PriceDecimal = VHS_Decimal
End If

'If user is a member then they recieve discount
If MemberBoolean Then
Return PriceDecimal * (1 - DISCOUNT_Decimal)
Else
Return PriceDecimal
End If
End Function

Private Sub CalculateToolStripMenuItem_Click Handles CalculateToolStripMenuItem.Click


Dim ItemAmountDecimal As Decimal
Dim MessageString As String

'If the Title Text Box is blank, ask user to enter title
If TitleTextBox.Text = "" Then
MessageString = "Please enter the Movie Title"
MessageBox.Show(MessageString, "Input Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
TitleTextBox.Focus()
ElseIf DVDRadioButton.Checked = False And VHSRadioButton.Checked = False Then
MessageString = "Please select the movie format"
MessageBox.Show(MessageString, "Input Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
Try
'ENTER REMARK HERE
ItemAmountDecimal = RentalFee

MemberCheckBox.Enabled = False 'WHAT DOES THIS LINE DO?

'ENTER REMARK HERE
ItemAmountTextBox.Text = ItemAmountDecimal.ToString("C")

'ENTER REMARK HERE
AmountDueDecimal += ItemAmountDecimal
AmountDueTextBox.Text = AmountDueDecimal.ToString("C")

Catch AnyException As Exception
MessageString = "Error: "
MessageBox.Show(MessageString & AnyException.Message)
End Try
End
End Sub

Private Sub ClearforNextItemToolStripMenuItem_Click Handles ClearforNextItemToolStripMenuItem.Click

'ENTER REMARK HERE
DVDRadioButton.Checked = False
VHSRadioButton.Checked = False
NewReleaseCheckBox.Checked = False
ItemAmountTextBox.Clear()
With TitleTextBox
.Clear()
.Focus()
End With
End Sub

Private Sub OrderCompleteToolStripMenuItem_Click Handles OrderCompleteToolStripMenuItem.Click

Dim ReplyDialogResult As DialogResult
Dim MessageString As String

'ENTER REMARK HERE
If AmountDueDecimal > 0 Then
ReplyDialogResult = MessageBox.Show("Do you wish to complete this order?", _
"Complete Order", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If ReplyDialogResult = DialogResult.Yes Then

'ENTER REMARK HERE
ClearforNextItemToolStripMenuItem_Click(sender, e)
AmountDueTextBox.Text = ""
With MemberCheckBox 'Allows the user to selest If they are a member or not
.Checked = False
.Enabled = True
End With
TitleTextBox.Focus()

'ENTER REMARK HERE
TotalCustAmtDueDecimal += AmountDueDecimal
TotalCustomersInteger = TotalCustomersInteger + 1
AmountDueDecimal = 0
End If
Else
MessageString = "You must calculate each item in the order"
MessageBox.Show(MessageString, "No data for this order")
End If
End Sub

Private Sub SummaryToolStripMenuItem_Click Handles SummaryToolStripMenuItem.Click
Dim MessageString As String

'ENTER REMARK HERE
If ItemAmountTextBox.Text <> "" Then
MessageString = "Incomplete Orders Are Not Included in Summary"
MessageBox.Show(MessageString, "Form is not blank", MessageBoxButtons.OK, MessageBoxIcon.Error)
ElseIf TotalCustomersInteger > 0 Then
SummaryForm.ShowDialog()
Else
MessageString = "No Data to Summarize"
MessageBox.Show(MessageString, "Su
Three answers:
Gardner
2010-11-03 20:40:04 UTC
Perhaps if you indicated exactly what syntax errors you were getting it would be helpful.
springsteen
2016-10-21 02:51:59 UTC
you are able to desire to examine my e book. the least puzzling thank you to debug an sq. string is to work out it. it is, unload the string to a Messagebox or to debug.print and seem to work out what's being generated. using fact which you have shortened the string that's annoying to tell what's incorrect. I propose utilising a Parameterized Command somewhat of an advert hoc sq. (as you have carried out). as a effect you create a separate Parameter merchandise for each parameter interior the INSERT fact and (contained relating to OLE DB) positioned a "?" somewhat of the textBox value. each and each Parameter.value is desperate to the TextBox.textual content purely previously executing the Command. See ADO and ADO.internet Examples and suited Practices. there's a VB.internet and a C# version (as properly as a VB6 version "ADO Examples and suited Practices". hth
Dan
2010-11-04 05:15:31 UTC
Ummm... doesn't Visual Studio highlight the syntax errors for you? How hard can it be...?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...