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 76 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.
  • D Dave Kreskowiak

    "Swiss made" implies elgance in design, using the least amount of parts in a well-thought out fashion. This is more German made, where the engineering uses the most amount of parts possible to do the simplest of jobs. The breech of a certain German artillery piece (can't remember which) was made with 192 parts. The equivilent artillery piece on the U.S. side used 48. The Swiss probably could have done it in 20.

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

    T Offline
    T Offline
    Thomas Weller 0
    wrote on last edited by
    #7

    What's your problem with Germans? There are idiots as well as geniuses and everything in between everywhere in the world... Maybe you should not care that much about weapons... :suss: Regards Thomas

    www.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
    Programmer - an organism that turns coffee into 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
      
      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #8

      Yeah, so it's long and wide, some methods have to be; what have you replaced it with?

      B 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
        
        P Offline
        P Offline
        peterchen
        wrote on last edited by
        #9

        :rolleyes:

        Don't attribute to stupidity what can be equally well explained by buerocracy.
        My latest article | Linkify!| FoldWithUs! | sighist

        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
          
          T Offline
          T Offline
          Thomas Weller 0
          wrote on last edited by
          #10

          So what? As far as I've seen it, all the magic numbers are commented (not totally sure, somewhere in the middle my eyes began to bleed)... :laugh: Regards Thomas

          www.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
          Programmer - an organism that turns coffee into software.

          1 Reply Last reply
          0
          • P PIEBALDconsult

            Yeah, so it's long and wide, some methods have to be; what have you replaced it with?

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

            Nothing yet, the problem is the whole application is badly design, so from my point of view it is better to build a new application from scratch.

            1 Reply Last reply
            0
            • T Thomas Weller 0

              What's your problem with Germans? There are idiots as well as geniuses and everything in between everywhere in the world... Maybe you should not care that much about weapons... :suss: Regards Thomas

              www.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
              Programmer - an organism that turns coffee into software.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #12

              :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 B C 3 Replies 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
                
                E Offline
                E Offline
                ed welch
                wrote on last edited by
                #13

                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 V 2 Replies 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:

                  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
                                          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