none
Operator '+' is not defined for types 'Label' and 'Label' RRS feed

  • Question

  • I'm writing some code and I've run into a roadblock. Please Help!

            Dim OT_Mon
            Dim OT_Mon_Hrs
            Dim Mon_Hrs
            Dim Mon_Ori_Hrs
            Dim OT_Tues
            Dim OT_Tues_Hrs
            Dim Tues_Hrs
            Dim Tues_Ori_Hrs
            Dim OT_Wed
            Dim OT_Wed_Hrs
            Dim Wed_Hrs
            Dim Wed_Ori_Hrs
            Dim OT_Thurs
            Dim OT_Thurs_Hrs
            Dim Thurs_Hrs
            Dim Thurs_Ori_Hrs
            Dim OT_Fri
            Dim OT_Fri_Hrs
            Dim Fri_Hrs
            Dim Fri_Ori_Hrs
            Dim OT_Sat
            Dim OT_Sat_Hrs
            Dim Sat_Hrs
            Dim Sat_Ori_Hrs
            Dim OT_Sun
            Dim OT_Sun_Hrs
            Dim Sun_Hrs
            Dim Sun_Ori_Hrs
            Dim OT_Hol
            Dim OT_Hol_Hrs
            Dim Hol_Hrs
            Dim Hol_Ori_Hrs
            Dim Week_Hrs
            Dim Sat_Hrs_Final
            Dim SunHol_Hrs
            Dim Final_Pay

    ' If The Employee has worked more than 9 hrs during weekdays they get paid 25% more if they work <= 3 hours and 45% more for 3>

            If txtMon.Text > 9 Then
                Mon_Ori_Hrs = txtMon.Text
                OT_Mon = txtMon.Text - 9
                If OT_Mon <= 3 Then
                    OT_Mon_Hrs = OT_Mon * 1.25
                    Mon_Hrs = OT_Mon_Hrs + Mon_Ori_Hrs
                    lblMonHrs.Text = Mon_Hrs
                ElseIf OT_Mon > 3 Then
                    OT_Mon_Hrs = OT_Mon * 1.45
                    Mon_Hrs = OT_Mon_Hrs + Mon_Ori_Hrs
                    lblMonHrs.Text = Mon_Hrs
                Else
                    lblMonHrs.Text = Mon_Ori_Hrs
                End If
            End If

            If txtTues.Text > 9 Then
                Tues_Ori_Hrs = txtTues.Text
                OT_Tues = txtTues.Text - 9
                If OT_Tues <= 3 Then
                    OT_Tues_Hrs = OT_Tues * 1.25
                    Tues_Hrs = OT_Tues_Hrs + Tues_Ori_Hrs
                    lblTuesHrs.Text = Tues_Hrs
                ElseIf OT_Tues > 3 Then
                    OT_Tues_Hrs = OT_Tues * 1.45
                    Tues_Hrs = OT_Tues_Hrs + Tues_Ori_Hrs
                    lblTuesHrs.Text = Tues_Hrs
                Else
                    lblTuesHrs.Text = Tues_Ori_Hrs
                End If
            End If

            If txtWed.Text > 9 Then
                Wed_Ori_Hrs = txtWed.Text
                OT_Wed = txtWed.Text - 9
                If OT_Wed <= 3 Then
                    OT_Wed_Hrs = OT_Wed * 1.25
                    Wed_Hrs = OT_Wed_Hrs + Wed_Ori_Hrs
                    lblWedHrs.Text = Wed_Hrs
                ElseIf OT_Wed > 3 Then
                    OT_Wed_Hrs = OT_Wed * 1.45
                    Wed_Hrs = OT_Wed_Hrs + Wed_Ori_Hrs
                    lblWedHrs.Text = Wed_Hrs
                Else
                    lblWedHrs.Text = Wed_Ori_Hrs
                End If
            End If

            If txtThurs.Text > 9 Then
                Thurs_Ori_Hrs = txtThurs.Text
                OT_Thurs = txtThurs.Text - 9
                If OT_Thurs <= 3 Then
                    OT_Thurs_Hrs = OT_Thurs * 1.25
                    Thurs_Hrs = OT_Thurs_Hrs + Thurs_Ori_Hrs
                    lblThursHrs.Text = Thurs_Hrs
                ElseIf OT_Thurs > 3 Then
                    OT_Thurs_Hrs = OT_Thurs * 1.45
                    Thurs_Hrs = OT_Thurs_Hrs + Thurs_Ori_Hrs
                    lblThursHrs.Text = Thurs_Hrs
                Else
                    lblThursHrs.Text = Thurs_Ori_Hrs
                End If
            End If

            If txtFri.Text > 9 Then
                Fri_Ori_Hrs = txtFri.Text
                OT_Fri = txtFri.Text - 9
                If OT_Fri <= 3 Then
                    OT_Fri_Hrs = OT_Fri * 1.25
                    Fri_Hrs = OT_Fri_Hrs + Fri_Ori_Hrs
                    lblFriHrs.Text = Fri_Hrs
                ElseIf OT_Fri > 3 Then
                    OT_Fri_Hrs = OT_Fri * 1.45
                    Fri_Hrs = OT_Fri_Hrs + Fri_Ori_Hrs
                    lblFriHrs.Text = Fri_Hrs
                Else
                    lblFriHrs.Text = Fri_Ori_Hrs
                End If
            End If

    ' For weekends they get +50% for overtime hrs

            If txtSat.Text > 9 Then
                Sat_Ori_Hrs = txtSat.Text
                OT_Sat = txtSat.Text - 9
                If OT_Sat > 0 Then
                    OT_Sat_Hrs = OT_Sat * 1.5
                    Sat_Hrs = OT_Sat_Hrs + Sat_Ori_Hrs
                    lblSatHrs = Sat_Hrs
                Else
                    lblSatHrs = Sat_Ori_Hrs
                End If
            End If

            If txtSun.Text > 9 Then
                Sun_Ori_Hrs = txtSun.Text
                OT_Sun = txtSun.Text - 9
                If OT_Sun > 0 Then
                    OT_Sun_Hrs = OT_Sun * 1.5
                    Sun_Hrs = OT_Sun_Hrs + Sun_Ori_Hrs
                    lblSunHrs = Sun_Hrs
                Else
                    lblSunHrs = Sun_Ori_Hrs
                End If
            End If

            If txtHol.Text > 9 Then
                Hol_Ori_Hrs = txtHol.Text
                OT_Hol = txtHol.Text - 9
                If OT_Hol > 0 Then
                    OT_Hol_Hrs = OT_Hol * 1.5
                    Hol_Hrs = OT_Hol_Hrs + Hol_Ori_Hrs
                    lblHolHrs = Hol_Hrs
                Else
                    lblHolHrs = Hol_Ori_Hrs
                End If
            End If

            If chkMan.CheckState = 1 Then
                Week_Hrs = (lblMonHrs + lblTuesHrs + lblWedHrs + lblThursHrs + lblFriHrs) * 30 <- This is where I'm having the                  trouble
                Sat_Hrs_Final = (lblSatHrs) * 33 <- I get the problem here
                SunHol_Hrs = (lblSatHrs + lblHolHrs) * 34 <- I get the problem here
                Final_Pay = Week_Hrs + Sat_Hrs_Final + SunHol_Hrs
                lblWageOut.Text = Final_Pay
            Else
                Week_Hrs = (lblMonHrs + lblTuesHrs + lblWedHrs + lblThursHrs + lblFriHrs) * 23 <- I get the problem here
                Sat_Hrs_Final = (lblSatHrs) * 26 <- I get the problem here
                SunHol_Hrs = (lblSunHrs + lblHolHrs) * 27 <- I get the problem here
                Final_Pay = Week_Hrs + Sat_Hrs_Final + SunHol_Hrs
                lblWageOut.Text = Final_Pay
            End If

    SEND HELP

    Wednesday, August 22, 2018 6:24 AM

All replies

  • Hi,

    modify the code:

       Week_Hrs = (lblMonHrs.Text + lblTuesHrs.Text + lblWedHrs.Text + lblThursHrs.Text + lblFriHrs.Text) * 30

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, August 22, 2018 6:46 AM