Click here to Skip to main content

Visual Basic

 
AnswerRe: Securing application password PinmemberDisIsHoody5-Oct-12 10:58 
GeneralRe: Securing application password PinmvpRichard MacCutchan5-Oct-12 23:40 
AnswerRe: Securing application password PinmemberMatty2211-Oct-12 18:29 
GeneralRe: Securing application password PinmemberDisIsHoody11-Oct-12 19:51 
GeneralRe: Securing application password PinmemberMatty2211-Oct-12 20:05 
GeneralRe: Securing application password PinmemberMatty2211-Oct-12 20:11 
GeneralRe: Securing application password PinmemberDisIsHoody12-Oct-12 10:28 
GeneralRe: Securing application password PinmemberMatty2212-Oct-12 14:53 
GeneralRe: Securing application password PinmemberDisIsHoody12-Oct-12 19:59 
QuestionVB6 Project - Printing Press Management System PinmemberMahesh KL3-Oct-12 6:58 
AnswerRe: VB6 Project - Printing Press Management System PinmvpDave Kreskowiak3-Oct-12 14:39 
AnswerRe: VB6 Project - Printing Press Management System PinmemberEddy Vluggen3-Oct-12 23:49 
SuggestionRe: VB6 Project - Printing Press Management System PinmemberJoan Murt4-Oct-12 1:47 
QuestionWorking from scratch based on created application PinmemberHerboren3-Oct-12 6:49 
I have a teacher who gave us a compiled application. He did not provide us the code. We have to generate the code in our head and write it out. It must act like his application in every possible way. I have it written out but for some reason when I type in the value of two(2) pieces the two(2) isn't calculated yet every other number I type calculates just fine. Why?
 
two(2) falls within range of 1-199 so its price would be calculated as rangeA * two(2) pieces = price for two, but no result is returned, my text does not display in the textbox either.
 
 Dim priceArrayElements(20) As Decimal ' Store Prices calculated, 21 count
    Dim pieceArrayElements(20) As Integer ' Store Pieces counted, 21 count

    Dim addedPieces ' Total of all Piece elements added together
    Dim totalAveragePieces ' Average of Piece elements added together / element count

    Dim addedPrices As Decimal ' Total of all price elements added together
    Dim totalAveragePrices As Decimal ' Average of Price elements added together / element count

    Dim elementCounter As Decimal ' Global Counter for both arrays

    Dim rangeA As Decimal = 0.5  ' Price applies to range   1 - 199
    Dim rangeB As Decimal = 0.55 ' Price applies to range 200 - 399
    Dim rangeC As Decimal = 0.6  ' Price applies to range 400 - 599
    Dim rangeD As Decimal = 0.65 ' Price applies to range 600 - >

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Select Case False
            Case IsNumeric(txtPieces.Text)
                MessageBox.Show("Pieces completed must be numeric.", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
                txtPieces.Text = ""
 
            Case Not IsNumeric(txtName.Text)
                MessageBox.Show("Name is required.", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
                txtName.Text = ""
 
            Case Else
 
                Select Case txtPieces.Text
                    Case 1 To 199
                        Try
                            For i As Integer = 0 To priceArrayElements.Length
                                priceArrayElements(i) = (Decimal.Parse(txtPieces.Text) * rangeA)
                                txtEarned.Text = FormatCurrency(priceArrayElements(i).ToString())
                            Next
                        Catch ex As Exception
                            'Supress Message
                        End Try
                    Case 200 To 399
                        Try
                            For i As Integer = 0 To priceArrayElements.Length
                                priceArrayElements(i) = (Decimal.Parse(txtPieces.Text) * rangeB)
                                txtEarned.Text = FormatCurrency(priceArrayElements(i).ToString())
                            Next
                        Catch ex As Exception
                            'Supress Message
                        End Try
                    Case 400 To 599
                        Try
                            For i As Integer = 0 To priceArrayElements.Length
                                priceArrayElements(i) = (Decimal.Parse(txtPieces.Text) * rangeC)
                                txtEarned.Text = FormatCurrency(priceArrayElements(i).ToString())
                            Next
                        Catch ex As Exception
                            'Supress Message
                        End Try
                    Case Else
                        If Int32.Parse(txtPieces.Text) >= 600 Then
                            Try
                                For i As Integer = 0 To priceArrayElements.Length
                                    priceArrayElements(i) = (Decimal.Parse(txtPieces.Text) * rangeD)
                                    txtEarned.Text = FormatCurrency(priceArrayElements(i).ToString())
                                Next
                            Catch ex As Exception
                                'Supress Message
                            End Try
                        End If
                End Select
 
        End Select
 
    End Sub
 
End Class

AnswerRe: Working from scratch based on created application PinmemberEddy Vluggen3-Oct-12 23:46 
AnswerRe: Working from scratch based on created application PinmemberDisIsHoody11-Oct-12 20:02 
QuestionHow may I add a MDITabControl to my project (VB2008) PinmemberMember 16752941-Oct-12 5:56 
AnswerRe: How may I add a MDITabControl to my project (VB2008) PinmemberEddy Vluggen1-Oct-12 6:14 
QuestionLOAD CSV FILES TO VB 8 Pinmembermemas6328-Sep-12 7:32 
AnswerRe: LOAD CSV FILES TO VB 8 PinmvpDave Kreskowiak28-Sep-12 8:03 
QuestionSOAP service responding with partial data Pinmemberloctrice28-Sep-12 6:17 
AnswerRe: SOAP service responding with partial data PinmvpDave Kreskowiak28-Sep-12 8:01 
GeneralRe: SOAP service responding with partial data Pinmemberloctrice28-Sep-12 8:03 
GeneralRe: SOAP service responding with partial data PinmvpDave Kreskowiak28-Sep-12 8:14 
QuestionVB 2005 Datagridview print PinmemberNigel14227-Sep-12 20:34 
AnswerRe: VB 2005 Datagridview print PinmvpRichard MacCutchan27-Sep-12 22:56 
QuestionHow can I distribute a VB6 application with NSIS? PinmemberfancyRocko27-Sep-12 3:08 
AnswerRe: How can I distribute a VB6 application with NSIS? PinmvpDave Kreskowiak27-Sep-12 14:38 
GeneralRe: How can I distribute a VB6 application with NSIS? PinmemberfancyRocko27-Sep-12 23:49 
GeneralRe: How can I distribute a VB6 application with NSIS? PinmemberEddy Vluggen28-Sep-12 0:03 
GeneralRe: How can I distribute a VB6 application with NSIS? PinmvpDave Kreskowiak28-Sep-12 2:16 
GeneralRe: How can I distribute a VB6 application with NSIS? PinmemberfancyRocko28-Sep-12 2:25 
AnswerRe: How can I distribute a VB6 application with NSIS? Pinmemberjrumage5-Oct-12 3:00 
QuestionPrinting Datagridview content plus header and footer in vb.net 2010 Pingroupsali2226-Sep-12 21:40 
AnswerRe: Printing Datagridview content plus header and footer in vb.net 2010 PinmvpAbhinav S26-Sep-12 22:00 
AnswerRe: Printing Datagridview content plus header and footer in vb.net 2010 Pingroupsali2226-Sep-12 22:13 
QuestionBefore a Control loses focus can I detect the next focus target? PinmemberRichard Fairhurst26-Sep-12 10:05 
AnswerRe: Before a Control loses focus can I detect the next focus target? [modified] PinmemberRichard Fairhurst26-Sep-12 11:32 
QuestionTelephone Tracking system through GPS Pinmemberwaner michaud26-Sep-12 9:12 
AnswerRe: Telephone Tracking system through GPS PinmemberEddy Vluggen27-Sep-12 1:16 
QuestionDatagrid row count equals zero PinmemberCesar00226-Sep-12 7:49 
AnswerRe: Datagrid row count equals zero PinmemberCesar00226-Sep-12 11:05 
QuestionRe: Datagrid row count equals zero PinmemberEddy Vluggen26-Sep-12 11:32 
AnswerRe: Datagrid row count equals zero PinmemberCesar00226-Sep-12 17:28 
QuestionTricky SQL Question Pinmemberttocsmi25-Sep-12 11:42 
AnswerRe: Tricky SQL Question PinmemberMartijn Kok25-Sep-12 12:40 
GeneralRe: Tricky SQL Question Pinmemberttocsmi25-Sep-12 15:13 
GeneralRe: Tricky SQL Question PinmemberBernhard Hiller26-Sep-12 0:13 
GeneralRe: Tricky SQL Question PinmemberMartijn Kok26-Sep-12 0:27 
GeneralRe: Tricky SQL Question Pinmemberttocsmi1-Oct-12 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.150129.1 | Last Updated 31 Jan 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid