Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. A real Mess

A real Mess

Scheduled Pinned Locked Moved The Weird and The Wonderful
graphics
34 Posts 24 Posters 86 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E ed welch

    Well, that code brings me back to the 90's. Typical "journeyman programmer" production. The journeyman programmer doesn't care about software engineering or improving the skills in their trade, just hack away until it works... eventually they work up their way to be project manager and leave the crap to someone else to maintain X|. Don't let it get to you too much the first 20 years are the worse :laugh:

    N Offline
    N Offline
    NormDroid
    wrote on last edited by
    #14

    Very well put :) I wouldn't even use the word 'programmer' in the same sense as VB, more like 'user'. VB - curse of many bad project implementations.

    Software Kinetics (requires SL3 beta) - Moving software

    D 1 Reply Last reply
    0
    • B Bernard Laplace

      This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

      Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
      Dim i As Integer
      Dim r As Integer
      Dim sEmployeeID As String
      Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
      Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
      Dim dDateCurrent As Date = dDateFrom
      Dim sConsultantInfoDay As String = ""
      Dim sProjectInfo1 As String = ""
      Dim sProjectInfo2 As String = ""
      Dim sProject As String = ""
      Dim DateEnd As Object
      Dim DaysNoticeExt As Object
      Dim sColor1 As String = "#FFFFFF"
      Dim sColor2 As String = "#FFFFFF"
      Dim PreviousColor As String = "#FFFFFF"
      Dim hl As New HyperLink
      Dim lb As New Label
      Dim lb2 As New Label
      Dim iDayofWeek As Integer
      Dim sDayName As String
      Dim sExit As String
      Dim bgColor As Drawing.Color
      Dim sColorProject As String = "#FFFFFF"
      Dim bTSClosed As Boolean
      Dim Hours As Double
      Dim HoursClientMonth As Double
      Dim HoursMonth As Double
      Dim HoursTBPMonth As Double
      Dim HoursInternalMonth As Double
      Dim DailyHoursTBP As Double
      Dim TSID As Integer
      Dim oEmpDateStart As Object
      Dim oEmpDateEnd As Object
      Dim bClientProject As Boolean = False
      Dim bProjectFoundMonth As Boolean = False
      Dim WorkPerc As Double
      Dim sHoliday As String
      Dim ProjectID As Integer
      Dim TotalHoursMonth As Double
      Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
      Dim intRenewalCpt As Integer = -1
      Dim blnIsFirstTime As Boolean = True
      Dim intRenewsEachNbMonths As Integer

      	Select Case e.Row.RowType
      		Case DataControlRowType.Header
      			Dim iMonth As Integer
      			e.Row.Cells(0).Visible = False
      			e.Row.Cells(1).Visible = False
      			e.Row.Cells(2).Visible = False
      			e.Row.Cells(3).Visible = False
      			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
      			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
      			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
      			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
      			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
      			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
      
      			i = iColDaysStart
      			Do While dDateCurrent <= dDateTo
      				iMonth = dDateCurrent.Month
      				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
      				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
      
      B Offline
      B Offline
      Bernard Laplace
      wrote on last edited by
      #15

      Hoorray! I fixed it!!!! Well when the procedure found a time over 4 hours for a day it used to skip the next records for that day :doh: I am so proud that I can not resist to post the fixed method :-D

      Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
      Dim i As Integer
      Dim r As Integer
      Dim sEmployeeID As String
      Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
      Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
      Dim dDateCurrent As Date = dDateFrom
      Dim sConsultantInfoDay As String = ""
      Dim sProjectInfo1 As String = ""
      Dim sProjectInfo2 As String = ""
      Dim sProject As String = ""
      Dim DateEnd As Object
      Dim DaysNoticeExt As Object
      Dim sColor1 As String = "#FFFFFF"
      Dim sColor2 As String = "#FFFFFF"
      Dim PreviousColor As String = "#FFFFFF"
      Dim hl As New HyperLink
      Dim lb As New Label
      Dim lb2 As New Label
      Dim iDayofWeek As Integer
      Dim sDayName As String
      Dim sExit As String
      Dim bgColor As Drawing.Color
      Dim sColorProject As String = "#FFFFFF"
      Dim bTSClosed As Boolean
      Dim Hours As Double
      Dim HoursClientMonth As Double
      Dim HoursMonth As Double
      Dim HoursTBPMonth As Double
      Dim HoursInternalMonth As Double
      Dim DailyHoursTBP As Double
      Dim TSID As Integer
      Dim oEmpDateStart As Object
      Dim oEmpDateEnd As Object
      Dim bClientProject As Boolean = False
      Dim bProjectFoundMonth As Boolean = False
      Dim WorkPerc As Double
      Dim sHoliday As String
      Dim ProjectID As Integer
      Dim TotalHoursMonth As Double
      Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
      Dim intRenewalCpt As Integer = -1
      Dim blnIsFirstTime As Boolean = True
      Dim intRenewsEachNbMonths As Integer

      	Select Case e.Row.RowType
      		Case DataControlRowType.Header
      			Dim iMonth As Integer
      			e.Row.Cells(0).Visible = False
      			e.Row.Cells(1).Visible = False
      			e.Row.Cells(2).Visible = False
      			e.Row.Cells(3).Visible = False
      			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
      			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
      			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
      			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
      			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
      			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
      
      			i = iColDaysStart
      			Do While dDateCurrent <= dDateTo
      				iMonth = dDateCurrent.Month
      				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.V
      
      D 1 Reply Last reply
      0
      • B Bernard Laplace

        This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

        Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
        Dim i As Integer
        Dim r As Integer
        Dim sEmployeeID As String
        Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
        Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
        Dim dDateCurrent As Date = dDateFrom
        Dim sConsultantInfoDay As String = ""
        Dim sProjectInfo1 As String = ""
        Dim sProjectInfo2 As String = ""
        Dim sProject As String = ""
        Dim DateEnd As Object
        Dim DaysNoticeExt As Object
        Dim sColor1 As String = "#FFFFFF"
        Dim sColor2 As String = "#FFFFFF"
        Dim PreviousColor As String = "#FFFFFF"
        Dim hl As New HyperLink
        Dim lb As New Label
        Dim lb2 As New Label
        Dim iDayofWeek As Integer
        Dim sDayName As String
        Dim sExit As String
        Dim bgColor As Drawing.Color
        Dim sColorProject As String = "#FFFFFF"
        Dim bTSClosed As Boolean
        Dim Hours As Double
        Dim HoursClientMonth As Double
        Dim HoursMonth As Double
        Dim HoursTBPMonth As Double
        Dim HoursInternalMonth As Double
        Dim DailyHoursTBP As Double
        Dim TSID As Integer
        Dim oEmpDateStart As Object
        Dim oEmpDateEnd As Object
        Dim bClientProject As Boolean = False
        Dim bProjectFoundMonth As Boolean = False
        Dim WorkPerc As Double
        Dim sHoliday As String
        Dim ProjectID As Integer
        Dim TotalHoursMonth As Double
        Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
        Dim intRenewalCpt As Integer = -1
        Dim blnIsFirstTime As Boolean = True
        Dim intRenewsEachNbMonths As Integer

        	Select Case e.Row.RowType
        		Case DataControlRowType.Header
        			Dim iMonth As Integer
        			e.Row.Cells(0).Visible = False
        			e.Row.Cells(1).Visible = False
        			e.Row.Cells(2).Visible = False
        			e.Row.Cells(3).Visible = False
        			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
        			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
        			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
        			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
        			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
        			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
        
        			i = iColDaysStart
        			Do While dDateCurrent <= dDateTo
        				iMonth = dDateCurrent.Month
        				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
        				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
        
        S Offline
        S Offline
        sucram
        wrote on last edited by
        #16

        I got a headache after the word Sub in line 1 and stopped reading. :laugh:

        Vita est usquequaque virtus victus ut plenus. Ego non sum semper iustus tamen Ego sum nunquam nefas!

        1 Reply Last reply
        0
        • N NormDroid

          Very well put :) I wouldn't even use the word 'programmer' in the same sense as VB, more like 'user'. VB - curse of many bad project implementations.

          Software Kinetics (requires SL3 beta) - Moving software

          D Offline
          D Offline
          DoctorMick
          wrote on last edited by
          #17

          In fairness, a lot of bad implementations are done in other languages, I dare say there are as many shocking apps developed in C# as there are VB.Net.

          N 1 Reply Last reply
          0
          • D Dave Kreskowiak

            :WTF: is your problem?? All I did was bring up something I saw in a documentery about artillery and it's reliablilty and maintainability, and you think I'm picking on the Germans? Dude, back then, during the war, they tended to over-engineer their weapons. That's all I'm saying...

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            A Offline
            A Offline
            Alessandro Bernardi
            wrote on last edited by
            #18

            I agree with you ;) And what's about an italian like me? Would you like me to speak about spaghetti code? :laugh: Luckly italian people does not always write spaghetti as they eat!! :P

            L 1 Reply Last reply
            0
            • E ed welch

              Well, that code brings me back to the 90's. Typical "journeyman programmer" production. The journeyman programmer doesn't care about software engineering or improving the skills in their trade, just hack away until it works... eventually they work up their way to be project manager and leave the crap to someone else to maintain X|. Don't let it get to you too much the first 20 years are the worse :laugh:

              V Offline
              V Offline
              Vozzie2
              wrote on last edited by
              #19

              14 more to go, i hope i'll make it... :~

              It feels good to learn and achieve

              1 Reply Last reply
              0
              • B Bernard Laplace

                This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

                Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                Dim i As Integer
                Dim r As Integer
                Dim sEmployeeID As String
                Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                Dim dDateCurrent As Date = dDateFrom
                Dim sConsultantInfoDay As String = ""
                Dim sProjectInfo1 As String = ""
                Dim sProjectInfo2 As String = ""
                Dim sProject As String = ""
                Dim DateEnd As Object
                Dim DaysNoticeExt As Object
                Dim sColor1 As String = "#FFFFFF"
                Dim sColor2 As String = "#FFFFFF"
                Dim PreviousColor As String = "#FFFFFF"
                Dim hl As New HyperLink
                Dim lb As New Label
                Dim lb2 As New Label
                Dim iDayofWeek As Integer
                Dim sDayName As String
                Dim sExit As String
                Dim bgColor As Drawing.Color
                Dim sColorProject As String = "#FFFFFF"
                Dim bTSClosed As Boolean
                Dim Hours As Double
                Dim HoursClientMonth As Double
                Dim HoursMonth As Double
                Dim HoursTBPMonth As Double
                Dim HoursInternalMonth As Double
                Dim DailyHoursTBP As Double
                Dim TSID As Integer
                Dim oEmpDateStart As Object
                Dim oEmpDateEnd As Object
                Dim bClientProject As Boolean = False
                Dim bProjectFoundMonth As Boolean = False
                Dim WorkPerc As Double
                Dim sHoliday As String
                Dim ProjectID As Integer
                Dim TotalHoursMonth As Double
                Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                Dim intRenewalCpt As Integer = -1
                Dim blnIsFirstTime As Boolean = True
                Dim intRenewsEachNbMonths As Integer

                	Select Case e.Row.RowType
                		Case DataControlRowType.Header
                			Dim iMonth As Integer
                			e.Row.Cells(0).Visible = False
                			e.Row.Cells(1).Visible = False
                			e.Row.Cells(2).Visible = False
                			e.Row.Cells(3).Visible = False
                			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                
                			i = iColDaysStart
                			Do While dDateCurrent <= dDateTo
                				iMonth = dDateCurrent.Month
                				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
                				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
                
                J Offline
                J Offline
                Jeroen De Dauw
                wrote on last edited by
                #20

                Did the author die? ;P

                GSoC 2009 student for SMW! --- My little forums: http://code.bn2vs.com --- 70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!

                0 B 2 Replies Last reply
                0
                • J Jeroen De Dauw

                  Did the author die? ;P

                  GSoC 2009 student for SMW! --- My little forums: http://code.bn2vs.com --- 70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!

                  0 Offline
                  0 Offline
                  0x3c0
                  wrote on last edited by
                  #21

                  That depends. Did the person who maintained the code have his home address?

                  Between the idea And the reality Between the motion And the act Falls the Shadow

                  1 Reply Last reply
                  0
                  • J Jeroen De Dauw

                    Did the author die? ;P

                    GSoC 2009 student for SMW! --- My little forums: http://code.bn2vs.com --- 70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!

                    B Offline
                    B Offline
                    Bernard Laplace
                    wrote on last edited by
                    #22

                    Well I have his home address, but I believe he's already dead, at least his brain was when he 'coded' this.

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      :WTF: is your problem?? All I did was bring up something I saw in a documentery about artillery and it's reliablilty and maintainability, and you think I'm picking on the Germans? Dude, back then, during the war, they tended to over-engineer their weapons. That's all I'm saying...

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      B Offline
                      B Offline
                      Bernard Laplace
                      wrote on last edited by
                      #23

                      French code smells cheese and has blue spots... :laugh:

                      J 1 Reply Last reply
                      0
                      • B Bernard Laplace

                        This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

                        Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                        Dim i As Integer
                        Dim r As Integer
                        Dim sEmployeeID As String
                        Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                        Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                        Dim dDateCurrent As Date = dDateFrom
                        Dim sConsultantInfoDay As String = ""
                        Dim sProjectInfo1 As String = ""
                        Dim sProjectInfo2 As String = ""
                        Dim sProject As String = ""
                        Dim DateEnd As Object
                        Dim DaysNoticeExt As Object
                        Dim sColor1 As String = "#FFFFFF"
                        Dim sColor2 As String = "#FFFFFF"
                        Dim PreviousColor As String = "#FFFFFF"
                        Dim hl As New HyperLink
                        Dim lb As New Label
                        Dim lb2 As New Label
                        Dim iDayofWeek As Integer
                        Dim sDayName As String
                        Dim sExit As String
                        Dim bgColor As Drawing.Color
                        Dim sColorProject As String = "#FFFFFF"
                        Dim bTSClosed As Boolean
                        Dim Hours As Double
                        Dim HoursClientMonth As Double
                        Dim HoursMonth As Double
                        Dim HoursTBPMonth As Double
                        Dim HoursInternalMonth As Double
                        Dim DailyHoursTBP As Double
                        Dim TSID As Integer
                        Dim oEmpDateStart As Object
                        Dim oEmpDateEnd As Object
                        Dim bClientProject As Boolean = False
                        Dim bProjectFoundMonth As Boolean = False
                        Dim WorkPerc As Double
                        Dim sHoliday As String
                        Dim ProjectID As Integer
                        Dim TotalHoursMonth As Double
                        Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                        Dim intRenewalCpt As Integer = -1
                        Dim blnIsFirstTime As Boolean = True
                        Dim intRenewsEachNbMonths As Integer

                        	Select Case e.Row.RowType
                        		Case DataControlRowType.Header
                        			Dim iMonth As Integer
                        			e.Row.Cells(0).Visible = False
                        			e.Row.Cells(1).Visible = False
                        			e.Row.Cells(2).Visible = False
                        			e.Row.Cells(3).Visible = False
                        			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                        			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                        			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                        			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                        			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                        			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                        
                        			i = iColDaysStart
                        			Do While dDateCurrent <= dDateTo
                        				iMonth = dDateCurrent.Month
                        				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
                        				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
                        
                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #24

                        I have seen worse Russian code. Best thing to do with monster code is to use some reflections on it.

                        1 Reply Last reply
                        0
                        • A Alessandro Bernardi

                          I agree with you ;) And what's about an italian like me? Would you like me to speak about spaghetti code? :laugh: Luckly italian people does not always write spaghetti as they eat!! :P

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #25

                          LMAO! :laugh: Ever here the American sing-a-long: 'On top of old meatball...'

                          1 Reply Last reply
                          0
                          • B Bernard Laplace

                            Hoorray! I fixed it!!!! Well when the procedure found a time over 4 hours for a day it used to skip the next records for that day :doh: I am so proud that I can not resist to post the fixed method :-D

                            Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                            Dim i As Integer
                            Dim r As Integer
                            Dim sEmployeeID As String
                            Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                            Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                            Dim dDateCurrent As Date = dDateFrom
                            Dim sConsultantInfoDay As String = ""
                            Dim sProjectInfo1 As String = ""
                            Dim sProjectInfo2 As String = ""
                            Dim sProject As String = ""
                            Dim DateEnd As Object
                            Dim DaysNoticeExt As Object
                            Dim sColor1 As String = "#FFFFFF"
                            Dim sColor2 As String = "#FFFFFF"
                            Dim PreviousColor As String = "#FFFFFF"
                            Dim hl As New HyperLink
                            Dim lb As New Label
                            Dim lb2 As New Label
                            Dim iDayofWeek As Integer
                            Dim sDayName As String
                            Dim sExit As String
                            Dim bgColor As Drawing.Color
                            Dim sColorProject As String = "#FFFFFF"
                            Dim bTSClosed As Boolean
                            Dim Hours As Double
                            Dim HoursClientMonth As Double
                            Dim HoursMonth As Double
                            Dim HoursTBPMonth As Double
                            Dim HoursInternalMonth As Double
                            Dim DailyHoursTBP As Double
                            Dim TSID As Integer
                            Dim oEmpDateStart As Object
                            Dim oEmpDateEnd As Object
                            Dim bClientProject As Boolean = False
                            Dim bProjectFoundMonth As Boolean = False
                            Dim WorkPerc As Double
                            Dim sHoliday As String
                            Dim ProjectID As Integer
                            Dim TotalHoursMonth As Double
                            Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                            Dim intRenewalCpt As Integer = -1
                            Dim blnIsFirstTime As Boolean = True
                            Dim intRenewsEachNbMonths As Integer

                            	Select Case e.Row.RowType
                            		Case DataControlRowType.Header
                            			Dim iMonth As Integer
                            			e.Row.Cells(0).Visible = False
                            			e.Row.Cells(1).Visible = False
                            			e.Row.Cells(2).Visible = False
                            			e.Row.Cells(3).Visible = False
                            			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                            			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                            			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                            			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                            			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                            			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                            
                            			i = iColDaysStart
                            			Do While dDateCurrent <= dDateTo
                            				iMonth = dDateCurrent.Month
                            				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.V
                            
                            D Offline
                            D Offline
                            Dan Neely
                            wrote on last edited by
                            #26

                            Arnaud Lhopiteau wrote:

                            I am so proud that I can not resist to post the fixed method Big Grin

                            No, 571 line long method can be considered non-broken.

                            It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains. -- Pride and Prejudice and Zombies

                            B 1 Reply Last reply
                            0
                            • D Dan Neely

                              Arnaud Lhopiteau wrote:

                              I am so proud that I can not resist to post the fixed method Big Grin

                              No, 571 line long method can be considered non-broken.

                              It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains. -- Pride and Prejudice and Zombies

                              B Offline
                              B Offline
                              Bernard Laplace
                              wrote on last edited by
                              #27

                              Well I can see I am not the only one practicing irony here, am I?

                              1 Reply Last reply
                              0
                              • D DoctorMick

                                In fairness, a lot of bad implementations are done in other languages, I dare say there are as many shocking apps developed in C# as there are VB.Net.

                                N Offline
                                N Offline
                                nullpointer 0
                                wrote on last edited by
                                #28

                                yup, I second that.

                                {}*

                                B 1 Reply Last reply
                                0
                                • B Bernard Laplace

                                  French code smells cheese and has blue spots... :laugh:

                                  J Offline
                                  J Offline
                                  jan larsen
                                  wrote on last edited by
                                  #29

                                  And Danish code is just sweet!...

                                  "God doesn't play dice" - Albert Einstein "God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr

                                  1 Reply Last reply
                                  0
                                  • N nullpointer 0

                                    yup, I second that.

                                    {}*

                                    B Offline
                                    B Offline
                                    BillW33
                                    wrote on last edited by
                                    #30

                                    I third that. I have seen far too much bad code in many languages. :sigh: Bill W

                                    Just because the code works, it doesn't mean that it is good code.

                                    1 Reply Last reply
                                    0
                                    • B Bernard Laplace

                                      Well this code has been made in Switzerland...

                                      G Offline
                                      G Offline
                                      Gautier Boder
                                      wrote on last edited by
                                      #31

                                      Snif :'( I vote for removing the Swiss citizenship of this programmer ;)

                                      1 Reply Last reply
                                      0
                                      • B Bernard Laplace

                                        This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

                                        Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                                        Dim i As Integer
                                        Dim r As Integer
                                        Dim sEmployeeID As String
                                        Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                                        Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                                        Dim dDateCurrent As Date = dDateFrom
                                        Dim sConsultantInfoDay As String = ""
                                        Dim sProjectInfo1 As String = ""
                                        Dim sProjectInfo2 As String = ""
                                        Dim sProject As String = ""
                                        Dim DateEnd As Object
                                        Dim DaysNoticeExt As Object
                                        Dim sColor1 As String = "#FFFFFF"
                                        Dim sColor2 As String = "#FFFFFF"
                                        Dim PreviousColor As String = "#FFFFFF"
                                        Dim hl As New HyperLink
                                        Dim lb As New Label
                                        Dim lb2 As New Label
                                        Dim iDayofWeek As Integer
                                        Dim sDayName As String
                                        Dim sExit As String
                                        Dim bgColor As Drawing.Color
                                        Dim sColorProject As String = "#FFFFFF"
                                        Dim bTSClosed As Boolean
                                        Dim Hours As Double
                                        Dim HoursClientMonth As Double
                                        Dim HoursMonth As Double
                                        Dim HoursTBPMonth As Double
                                        Dim HoursInternalMonth As Double
                                        Dim DailyHoursTBP As Double
                                        Dim TSID As Integer
                                        Dim oEmpDateStart As Object
                                        Dim oEmpDateEnd As Object
                                        Dim bClientProject As Boolean = False
                                        Dim bProjectFoundMonth As Boolean = False
                                        Dim WorkPerc As Double
                                        Dim sHoliday As String
                                        Dim ProjectID As Integer
                                        Dim TotalHoursMonth As Double
                                        Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                                        Dim intRenewalCpt As Integer = -1
                                        Dim blnIsFirstTime As Boolean = True
                                        Dim intRenewsEachNbMonths As Integer

                                        	Select Case e.Row.RowType
                                        		Case DataControlRowType.Header
                                        			Dim iMonth As Integer
                                        			e.Row.Cells(0).Visible = False
                                        			e.Row.Cells(1).Visible = False
                                        			e.Row.Cells(2).Visible = False
                                        			e.Row.Cells(3).Visible = False
                                        			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                                        			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                                        			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                                        			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                                        			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                                        			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                                        
                                        			i = iColDaysStart
                                        			Do While dDateCurrent <= dDateTo
                                        				iMonth = dDateCurrent.Month
                                        				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
                                        				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
                                        
                                        0 Offline
                                        0 Offline
                                        0x01AA
                                        wrote on last edited by
                                        #32

                                        You are almost predestined to apply a Laplace transformation ;P :laugh:

                                        1 Reply Last reply
                                        0
                                        • B Bernard Laplace

                                          This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

                                          Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                                          Dim i As Integer
                                          Dim r As Integer
                                          Dim sEmployeeID As String
                                          Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                                          Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                                          Dim dDateCurrent As Date = dDateFrom
                                          Dim sConsultantInfoDay As String = ""
                                          Dim sProjectInfo1 As String = ""
                                          Dim sProjectInfo2 As String = ""
                                          Dim sProject As String = ""
                                          Dim DateEnd As Object
                                          Dim DaysNoticeExt As Object
                                          Dim sColor1 As String = "#FFFFFF"
                                          Dim sColor2 As String = "#FFFFFF"
                                          Dim PreviousColor As String = "#FFFFFF"
                                          Dim hl As New HyperLink
                                          Dim lb As New Label
                                          Dim lb2 As New Label
                                          Dim iDayofWeek As Integer
                                          Dim sDayName As String
                                          Dim sExit As String
                                          Dim bgColor As Drawing.Color
                                          Dim sColorProject As String = "#FFFFFF"
                                          Dim bTSClosed As Boolean
                                          Dim Hours As Double
                                          Dim HoursClientMonth As Double
                                          Dim HoursMonth As Double
                                          Dim HoursTBPMonth As Double
                                          Dim HoursInternalMonth As Double
                                          Dim DailyHoursTBP As Double
                                          Dim TSID As Integer
                                          Dim oEmpDateStart As Object
                                          Dim oEmpDateEnd As Object
                                          Dim bClientProject As Boolean = False
                                          Dim bProjectFoundMonth As Boolean = False
                                          Dim WorkPerc As Double
                                          Dim sHoliday As String
                                          Dim ProjectID As Integer
                                          Dim TotalHoursMonth As Double
                                          Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                                          Dim intRenewalCpt As Integer = -1
                                          Dim blnIsFirstTime As Boolean = True
                                          Dim intRenewsEachNbMonths As Integer

                                          	Select Case e.Row.RowType
                                          		Case DataControlRowType.Header
                                          			Dim iMonth As Integer
                                          			e.Row.Cells(0).Visible = False
                                          			e.Row.Cells(1).Visible = False
                                          			e.Row.Cells(2).Visible = False
                                          			e.Row.Cells(3).Visible = False
                                          			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                                          			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                                          			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                                          			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                                          			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                                          			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                                          
                                          			i = iColDaysStart
                                          			Do While dDateCurrent <= dDateTo
                                          				iMonth = dDateCurrent.Month
                                          				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
                                          				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
                                          
                                          G Offline
                                          G Offline
                                          GKP1992
                                          wrote on last edited by
                                          #33

                                          Most code is like Dr.Frankenstein's mosnter. The only difference between good monster and bad monster is the good one has it's legs and hands and all else where they should be.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups