Below you will see some code I ran into a couple days ago. It is one of those things that took me back to 3rd grade math and made me second guess myself. If you look there is a new integer declared and it is set to zero. Then a loop starts in reverse order to iterate through some tabs which are always going to be a quantity of 5. What is interesting is that the integer is multiplied by -1. At first glance it made sense, multiply 1 times -1 you get -1, 2 times -1 = -2. But the value of intTabCounter was never being set inside the loop. So it appears that it was always zero. And sure enough as I debugged the code it was always zero. So it was completely useless.
Dim intTabCounter As Integer = 0
For intTabIndex As Integer = tcNewsDayTabs.Tabs.Count - 1 To 0 Step -1
tabDate = Date.Today.AddDays((intTabCounter * -1))
tabDate = NewsUtil.FindBusinessDayDate(tabDate.AddDays(1), ldTabPanelDates)
ldTabPanelDates.Add(intTabIndex, tabDate)
Next intTabIndex
This is an example of a time something looks good on the surface but has no functional value once you look a little deeper. In a bad economy like we have these days I look at this as job security.
Comments