|
|
surely its obvious
ViewState increments it 
|
|
|
|
|
Rich.Edwards wrote: This really pushes my buttons
or not
|
|
|
|
|
For some reason, I think they've made that second line overcomplicated...
If (rst!general_damages <> "100000+") Then
F.txtDamages = Left("" & rst!general_damages, InStr(1, "" & rst!general_damages, "-", vbTextCompare) - 1)
Else
F.txtDamages = Left("" & rst!general_damages, InStr(1, "" & rst!general_damages, "+", vbTextCompare) - 1)
End If
and further down...
MsgBox "Error occured with Worksource ID " & Val("" & F.txtWorksourceID) & " cannot be found"
txtWorksourceID is a text box, so this prepends an empty string to the contents of a text box, converts that to a number, then converts that back to a string to include in a message.
It works of course (there are many,m nay subtle bugs in this project), but doesn't exactly improve maintainability.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
modified 19-Feb-14 6:49am.
|
|
|
|
|
Looks like some VB4 code - prepending with an empty string is to cast the variable to a string. Usually only needed if you are concatenating strings which may hold numeric data.
Much better ways to castin VB6
|
|
|
|
|
"Looks like some VB4 code" - apparently not, the company was born in 2003!
The code is liberally littered with them. I can almost forgive it on db access:
Dim s As String
s = "" & rs!value
but really don't see its use in some cases, to paraphrase, things like:
Dim i As Integer
Dim s As String
s = 123
s = 123 & ("" & val(s)) && ("" & i)
I think the approach is "we're not sure when we need to cast, or how to do it, so we'll cast everywhere just in case.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Rob Grainger wrote: The code is liberally littered with them. I can almost forgive it on db
access:
<SPAN class=code-keyword>Dim</SPAN> s <SPAN class=code-keyword>As</SPAN> <SPAN class=code-keyword>String</SPAN>
s = <SPAN class=code-string>"</SPAN><SPAN class=code-string>"</SPAN> & rs!value
Thats where I normally come across it - I'd suspect they found the same site/book to find out how to code it as the originators of the software I work on.
Rob Grainger wrote: I think the approach is "we're not sure when we need to cast, or how to do it,
so we'll cast everywhere just in case.
hehe at least they're consisent 
|
|
|
|
|
Rob Grainger wrote: "Looks like some VB4 code" - apparently not, the company was born in 2003!
The brain guilty of creating that code must have been ossified for at least 6 years then. (VB5 came out in 97.)
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Just found this:
private void trySave(ref clsWord objWord, string strFullPath, Format format)
{
try
{
objWord.save(strFullPath, format);
}
catch (InvalidOperationException ex)
{
if (ex != null)
{
trySave(ref objWord, strFullPath, format);
}
}
}
modified 18-Feb-14 9:11am.
|
|
|
|
|
'Tis a lesson you should heed:
Try, try, try again.
If at first you don't succeed,
Try, try, try again.
|
|
|
|
|
Yeah, but your version stops after three goes...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
And what's that ex != null for? 
|
|
|
|
|
For a moment I thought about that, but then I just gave up try ing.
|
|
|
|
|
I think he got NullReferenceException so added that condition to avoid the error
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
Well, eventually it will, but detrimentously: the StackOverflowException won't be dealt with at this place.
|
|
|
|
|
The code is complete bullshit!
- What is the point of using ref?
objWord is not assigned any value. I guess, the author has never heard of reference types and value types, doesn't differentiate them and also is a former C++ developer. - If an exception is generated, a variable, representing it, can NEVER be
null . And the check
ex != null just looks stupid. - Also, it will sound very upsetting for the author, but if the exception mentioned above is ever generated, he is about to face an infinite recursion, hence he will also face the full power of the
StackOverflowException .
Summarizing the above, I'd say he better work in McDonald's. To get a chance to become a manager , that is a real chance to afford Ford Mustang GT... someday .
lifecycle of a lifecycle of a lifecycle
|
|
|
|
|
Lol. Btw, to add some background, I'm a contractor at a company that bought another company in the same business. A very successfull software came in the bundle (and of course they plan to merge its features into their own software), but little to no documentation came along and now people are having a hard time figuring bugs things out.
It is BS at so many levels, indeed, but the other products make up for it.
|
|
|
|
|
The good news is that developer's probably not writing code anymore. Probably your boss by now!
"If Crime Fighters fight crime, and Fire Fighters fight fire, what do Freedom Fighters fight?" - George Carlin
|
|
|
|
|
<voice type="Ebeneezer Scrooge"> Bah. dumb bugs </voice>
|
|
|
|
|
Few days back I came across following code
if(gender.contains('male'))
{
DoMaleThing();
}
else
{
DoFemaleThing();
}
Was not sure whether my colleague was knowing that 'female' option also contains 'male' in it.
Had a great laugh with my TL when I showed him this.
Do not go where the path may lead. Go instead where there is no path and leave a trail.
|
|
|
|
|
Well... Didn't you know it would have been discriminating otherwise 
|
|
|
|
|
Ohh..now I understood the code who wrote this is a lady
Do not go where the path may lead. Go instead where there is no path and leave a trail.
|
|
|
|
|
If you put some effort to it you can mess up an enum too.
|
|
|
|
|
Lost in translation? It would work in most other languages.
Also, he could consider: ladies first!
|
|
|
|
|
Years ago, I worked on a pension system and one of the calculations was to find the retirement age, the standard function was [converted to C# as I can't remember Prolog]:
int normalRetirementAge()
{
if (isMale())
{
return 65;
}
else
{
return 60;
}
}
Now, one client had everyone on their scheme retire at 60 irrespective of sex, the proposed solution by the PFY:
int normalRetirementAge()
{
if (isMale())
{
return 60;
}
else
{
return 60;
}
}
speramus in juniperus
|
|
|
|