|
PeterTheGreat wrote: There are no Subs!!
They got something right then :-P
Russ
|
|
|
|
|
Unfortunately this is a misfeature of VB.NET that's inherited from VB6. If you declare a Function , but omit the type of the return value, it is implicitly Object (Variant in VB6).
The other misfeature is that in Classic VB, the return value of the function was set by assigning to the name of the function - there was no Return statement. The last value set was the return value, but it didn't return straight away when set. This was very confusing. You could easily forget to set it (in which case it would be defaulted, I think, to the default value for the type, in this case Nothing ).
Option Strict fixes many problems in VB code (or, rather, turns them into compile-time errors, forcing you to fix them), and thankfully failing to define the return value of a function is one of them, at least as of VB 7.1 (.NET 2003). You will have to fix all the type-coercion errors if you turn it on, though, using explicit casts. I try to use DirectCast where possible (where I know that the object is already of the type I'm asking it to convert to).
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
That's some pretty bad naming for the functions. According to the naming conventions of .NET, I believe it should be ValidateSession() or at least something with a verb. ValidSession is something I'd use for a boolean value.
ROFLOLMFAO
|
|
|
|
|
Hi Peter,
PeterTheGreat wrote: Outsourcing Contrators
I'm curious. Where did you get your contractors or the firm with which you are contracting?
Jeff
|
|
|
|
|
PeterTheGreat wrote: compiled a project from our Outsourcing Contrators...
That kind of tells something. I'll just keep my Soapbox thoughts about outsourced contractors to myself
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
happened to me today: (in C++)
if (condA ||
condB ||
condC ||
condD,
condE)
{
...
}
Of course I wanted to "or" all conditions, but at some point I must have figured to be in a list or something. For anyone not familiar with the comma operator, its worth looking at. I didn't make use of it except e.g. int x=3, y=5; until now (and thats a couple of years).
-- modified at 11:52 Monday 26th November, 2007
|
|
|
|
|
So what's the result? In C# it just says that the comma is invalid there.
|
|
|
|
|
"Consider the expression
e1 , e2
The type and value of the expression are the type and value of e2; the result of evaluating e1 is discarded."
From MSDN[^]
Information at you fingertip.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Steve Hansen wrote: In C# it just says that the comma is invalid there.
yah
|
|
|
|
|
Unless there are side effects of the other conditions, your example is the equaivant of this:
if (condE)
{
...
}
|
|
|
|
|
Right. One can probably do awful things using commas given the right modulation of commas and semicolons - even outside variable declarations and for-statements.
|
|
|
|
|
Doc Lobster wrote: One can probably do awful things using commas
... such as implementing an assignment library[^]
|
|
|
|
|
|
I how the docs page starts with that quote from Stroustrup.
|
|
|
|
|
So, next time you quit a job because you hate it, don't forget to throw in a few commas here and there
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
hehe.. I like your style
Michael Davey
biproject.com rss and blog news in a more palatable format
mobile edition now available!
|
|
|
|
|
Comma operator generates right operand value so condE for this example.
|
|
|
|
|
easiest mistake is not comma
is == sign by just =
from,
-= aLbert =-
|
|
|
|
|
Of course in C++ the comma operator can be overloaded like most others.
So one can make things really interesting.
|
|
|
|
|
Hi, I found this code in an old VB6 app that we need to "upgrade" (in fact replace with a new one be a much better approach, but...)
cbo_Caminos is a ComboBox, o_rs is defined as ADODB.Recordset
If CInt(Trim(Mid(cbo_Caminos.Text, 151, 6))) = CInt(o_Rs.Fields("NroCamino")) Then<br />
....<br />
'do something <br />
End If<br />
And yes o_Rs.Fields("NroCamino") is an integer
Why not use ItemData of the combobox to store de integer value associated whit the content of the combobox text?
More on the same form
Private Sub .......()<br />
Dim o_rs As New ADODB.Recordset <br />
Dim s_Sql As String<br />
<br />
s_Sql = "" <br />
s_Sql = "Select * from ......" <br />
<br />
Set o_rs = New ADODB.Recordset <br />
Set o_rs = DBConnect.Execute(s_Sql)<br />
.....<br />
.....<br />
<br />
If mAutmoatico Then ' mAutmoatico is boolean defined as global var<br />
s_Sql = ""<br />
s_Sql = "Select .....<br />
s_Sql = s_Sql & "From ...."<br />
s_Sql = "Where ...."<br />
set o_rs = DBConnect.Execute(s_Sql)<br />
....<br />
End If
For some miraculous reason mAutmoatico is always false when reach the above If
Enjoy.
Habetis bona deum
|
|
|
|
|
DoomedOne wrote: For some miraculous reason mAutmoatico is always false when reach the above If
Good thing, too. 'Cause I don't think the sql is going to work very well. It will only have a where clause in it.
|
|
|
|
|
DoomedOne wrote: old VB6 app that we need to "upgrade"
I dont think VB6 has an upgrade path
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
He could always move on to VB6's offspring. It has already surpassed its parent!
ROFLOLMFAO
|
|
|
|
|
leppie wrote: I dont think VB6 has an upgrade path
Yes it has - it's called the Recycle Bin.
|
|
|
|
|