Author |
Topic |
jhermiz
3564 Posts |
Posted - 2005-01-17 : 07:36:13
|
What are your thoughts on using it?Should I keep this on and deal with all these conversion errors and fix em up ?For instance I get the following error:Option strict on disallows implicit conversions from Integer to Microsoft.VisualBasic.DateFormat On this line: If FormatDateTime(Now(), 4) > "12:00" ThenBut how can I adjust that type of function? Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
|
|
jhermiz
3564 Posts |
Posted - 2005-01-17 : 07:37:32
|
Hmm this seems to have done it:If FormatDateTime(Now(), DateFormat.ShortTime) > "12:00" Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-17 : 07:40:16
|
Ok next question I have: Public Function SetFooter(ByVal f As String) lblFooterName.Text = f End FunctionBut option strict on requires all functions and property declarations to have an 'As' clause. This function returns nothing...so should I just have it return boolean ? Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2005-01-17 : 08:06:25
|
If you dont require a return parameter - make it a sub routine. |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-01-17 : 10:14:57
|
My advice -- ALWAYS use option strict. It's the best. it forces you to be a good programmer, and disallows any implicit conversions that might happen in ways you don't anticipate. It really is a great feature, one that VB really needed to become a "real" language.- Jeff |
 |
|
Auric
Yak Posting Veteran
70 Posts |
Posted - 2005-01-31 : 00:15:49
|
I couldn't agree with jsmith more.... I have been programming with .NET for a year or so now, (yeah yeah..im in college) the teacher always forces us to use strict on because it forces you to maintain proper data structure. The worst thing is programming a huge function, and realizing that you forgot to cast a few variables to the proper data type, without strict on it may work and give incorrect results. Thus lulling you into a false sense of security. It's VERY good programming practise to be very specific with what the code accepts. An old computer programming addage "Garbage in means garbage out" comes to mind. Select * from users where clue > 0 |
 |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2005-01-31 : 00:59:33
|
Use C# Otherwise, yes, use Option Explicit always.Damian |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-31 : 02:10:35
|
yeah C# rules and you don't have to deal with stuff like that!! don't know why but i always hated any incarnation of VB.Go with the flow & have fun! Else fight the flow |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-31 : 08:27:30
|
I wasn't speaking of option explicit, I was refering to Option Strict On which is much different.There is nothing wrong with VB.net, everything you can do in C# is almost identical to VB.net. Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
 |
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2005-01-31 : 09:29:07
|
>>There is nothing wrong with VB.net, everything you can do in C# is almost identical to VB.netA good argument for using C# :) While this debate has raged on since the intro of the languages it is ultimately a personal choice - each language will appeal to a particular audience. VB.net provides a comfortable transition for vb programmers and c# closely matches java.I prefer c# for several reasons. Here are a couple:- Code is less verbose than vb - and this is also evident in the IL code.- C# has been submitted to the ECMA committee to become a standard and is currently supported by Mono. |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-31 : 09:34:56
|
Like I said, It doesn't matter, anything anyone can do in C# can be done in VB.net. I have used C# in the past and I like both languages, it's not like we are comparing ASM to C++. Learning C# or VB.net and because they are so much similiar is totally simple. Saying that one is easier or more difficult than the other is hardly a reasonable argument. In fact there are plenty of sites that convert C# to vb.net and vice versa. Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-31 : 17:39:47
|
quote: anything anyone can do in C# can be done in VB.net
Not exactly true, but pretty close. I don't have any problem with VB.Net, my preference is c# because I have been doing c# for the last 2.5 years. I used to like VB.Net better, but that was because I was on a VB.Net project. You really should be able to do either.Anyway, the point of the post was that you can't do EVERYTHING in VB.Net, there are several examples one of which is Operator overloading.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-31 : 17:41:04
|
Oh, and I wouldn't use VB.Net withought Option Strict On.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-31 : 18:37:42
|
Operator overloading is now available in the beta version of .net.And as for your second comment I now always include that :)..I had option explicit but definately using option strict on.Thanks Chad,Jon Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-02-01 : 00:07:56
|
You mean .Net Framework 2.0? Cool, I haven't had a chance to check that out yet.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
jhermiz
3564 Posts |
Posted - 2005-02-01 : 08:37:26
|
Yes, 2.0 has operator overloading for vb.net. Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-02-01 : 09:08:22
|
Does it have the XML documentation feature of C#? I love that feature, it is very well done and easy to use. I could never understand why VB.net didn't have that built in (though there is a download out there by someone who wrote an Add-In that does the same thing, but I haven't fully tested it yet)- Jeff |
 |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2005-02-01 : 09:42:29
|
One thing that C# has that VB.NET needs is multi line comments.Dustin Michaels |
 |
|
Auric
Yak Posting Veteran
70 Posts |
Posted - 2005-02-03 : 11:02:20
|
ewww operator overloading *bangs head on desk* reminds me of a C++ test I just wrote. I agree Dustin, multiline comments would be nice. Too bad it wasn't like Java /** and then **/ or C /* */ type of deal. :) Too many languages floating around my head. ORG $8000 Select * from users where clue > 0 |
 |
|
|