Pros And Cons Of Option Compare Binary/Text In .NET?

Jun 22, 2011

What are the pros and cons of standardizing on using Option Compare Text vs Option Compare Binary for VB.NET development?

- EDIT -Just some background since it seems like it would help - my development team has found it much easier to standardize on Option Strict On, Option Infer On, and Option Explicit due to their obvious advantages over the alternatives. What we haven't found as easy to standardize on is Option Compare Text/Binary as there seem to be advantages and disadvantages to both and different developers have differing opinions. Some of the arguments for each side have been as follows:

Some of the advantages/arguments for Option Compare Text:

It reduces verbosity in the code by removing the need for StringComparers and .ToLower() calls and StringComparison.OrdinalIgnoreCase all over the place Data needs are rarely concerned with casing, as evidenced by most databases being case-insensitive. Rarely would you ever really want to distinguish between THIS and This and this when doing a data comparison.

Certain specific use cases are simpler when you don't have to worry about casing. For example, handling ASP.NET control events where commands are sent to the codebehind as strings and casing-issues are difficult to track down as the compiler cannot help you. Think Select Case statements for <asp:repeater> events as an example.Many of the concerns raised about text comparison concern internationalization, which is often not that relevant to a lot of applications.VB specifically is case insensitive as a language, though Visual Studio helps you by at least enforcing consistency in your casing. SQL is case insensitive as well. Strings are the only place where you have to remember to worry about it, which highlights the awkwardness in ways you wouldn't normally notice it if you were worried about it everywhere.

Some of the advantages/arguments for Option Compare Binary:C# works this way, as do most other languages. It's somewhat unexpected to have alternate behavior and the unexpected is not good in programming.There is a slight performance penalty with Option Compare Text as evidenced by the IL generated on compile. Option Compare Binary doesn't have that penalty.Option Compare Text only makes certain parts of string handling case insensitive. But, it doesn't make it so that things like dictionary indexing are case insensitive by default. So, it's not like Option Compare Text actually makes it so that you don't have to worry about casing at all. If it only works half way, why bother?Programming is hard. It's best not to attempt to smooth over that fact. Worrying about string casing is part of the deal. Humans recognize THIS is different from This and tHiS. Of course your code should too - after all, they aren't really the exact same string.

View 3 Replies


ADVERTISEMENT

.net - Pros And Cons Of VB And VBA?

Aug 28, 2009

On another programming related website, I saw this line in someone's signature. This is NOT the first time I've seen such sentiments, although this is the harshest:"People who work in VB or any variant thereof are not programmers, they are circus chimps throwing feces into an IDE..."VBA is my bread and butter and I can automate quite a bit of stuff with it. Yes, I know it lacks polish and some functionality, but why so much negativity toward it? On the flip side, what do other languages have that VB doesn't?

View 9 Replies

.net Vs Vb6 Pros And Cons?

Feb 13, 2007

i am a seasoned vb6 and vb.net developer and where i currently work, they use VB6. Now, we develop a range of office plugins for a client, and they currently use vb6, they also do some other projects with vb6. I want them to change to vb.net They have asked me for a list of Pros for switching, and also some Cons.

The pros i have are: .Net is future proofed, VB6 will not be supported by Microsoft for much longer One standard platform to run on (.Net) removing problems of windows versions and missing dlls full OOP support and a generic Api for office application development. Integrate seamlessly with Java using bridging components (they are primarily a java house)Quicker performance On event application loading (in office) to help application performance. Application controls are loaded but the code to execute is only loaded when required, reducing application load on start up.Backwards compatible to Office and Outlook 2003

View 12 Replies

Pros And Cons Of Using Abstract Classes

Nov 18, 2010

I have been reading up on Abstract classes and am thinking about utilizing them in an upcoming project.

I would like to know the pros and cons of using abstract classes from someone who has actually used them.

Additionally, I would like to know if the abstract class needs to be in it's own project or if they should be defined in an existing project and used within the application.

View 1 Replies

Call - Pros And Cons Of Calling Procedures?

Dec 4, 2009

I would like to know the pros and cons of calling procedures with Call Keyword and without Call in VB.NET?

Private Sub ProOne()
// Code Are Here
End Sub[code].....

View 5 Replies

.net - System.net.mail Isbodyhtml = True Vs Two AlternateViews Pros/cons?

Dec 30, 2010

Here is the use case: I am making an app that will email HTML Newsletters. The app will also email a plain text version of the newsletter as an alternate view. The way I see it there are two ways of going about this when using the system.net.mail namespace. What are the pro/cons of these two ways, or is there a another way that I am missing?

[Code]...

View 1 Replies

What Are The Pros To Using "option Explict"

Apr 20, 2012

All it really does is make me have to dim each variable, making it compile badly if I forget to dim a variable.

View 3 Replies

.net - Get The Value For 'Option Compare' At Runtime?

Apr 4, 2012

For debugging purposes, is it possible to get the value of Option Compare at runtime?

(I am working on a legacy Windows Forms application that uses InStr with the first parameter as String (three parameter version of Instr), without the third parameter that is then determined by Option Compare. Option Compare Text supposedly makes InStr case-insensitive; the default is Option Compare Binary.)

View 1 Replies

VS 2005 Using Option Compare?

Jul 1, 2010

I am self learning vb. Currently i am developing an accounting application(Just finished one form). This is the first time i have come across 'Option Compare'.I have few text comparisons in my first form, Currently i am comparing both the text's by converting it to lower. Should i change the option compare to Text and remove the ToLower conversions. Will it make difference in the performs and is setting the Option Compare to Text proper for this kind of applications.

View 1 Replies

Case (in) Sensitive Comparison With Operator In Runtime (without Option Compare)

Jun 24, 2011

Is there anyway to use LIKE operator in VB.NET as case sensitive or insensitive during runtime? For example use a flag to do case sensitive or insensitive comparisons.Obviously this can be done by simple converting them into lower case and forcing application to Option Compare Binary but maybe there is a better way to do this?

View 1 Replies

Compare Date - Compare Textbox1 And Textbox2 Text

Mar 3, 2010

I have two textbox in my application.

Textbox1.Text="19-Jan-2010"

Textbox2.Text="Jan 2010"

May I know how can I compare that Textbox1 and Textbox2 text is within same month and same year?

View 1 Replies

Application Config Suggested Ways Pro And Cons

Apr 6, 2012

I have a general question on app.config, or the best way to NOT hard code a SmtpServer.Host = XXXXXXXX setting. I wrote this very simple SMTP texting application and wanted to have the settings not hard code but a form that read or writes to app.config or .ini or registry. my question is the pros and cons? and if anyone hae suggested or a link to sample project that is doing what I'm after. I have a single .exe and am new to vb.net and either want the exe to check for app.config, ini or registry if does not exist to create and then save added config, if the exe runs again it uses the newly created settings.

View 5 Replies

Compare Between 2 Text Files And Save It In New Text?

Apr 2, 2009

I have many txt files, and i have to select any txt file to search and compare match fields with file: CompareText.txt. My text file format:

20090227#2#B010110100#3787.562904#
20090227#2#B010110200#430556.987989#
20090227#2#B010110213#2146515.91#

[code].....

View 4 Replies

Convert Binary(?) To Text?

Mar 17, 2009

How do I convert this file (Attached) to a readable text file (its XML code).I found code here and there but doesnt work. I want to grab the whole file and dump it back out as readable text.

View 10 Replies

Converting Binary To Text?

Aug 19, 2009

Okay here is the code I'm using to convert text to binary and then back to text for display.

Module convertbinary
Public Function ConvertToText(ByVal BinText As String)
Dim BinChar As String

[Code].....

What I'm trying to do is store a query string in a table cell. So I figured the best way would be to convert the query string to some binary format for storing and then when I pull it out of the database I would convert it back to a string of text.

View 1 Replies

Compare What Is In My Text Box?

May 15, 2012

It's been a long time and I'm very rusty on my VB.

I did something like this years ago and now I'm stumped.

My application flows like this-

-From my form, I have a text box.

-I scan a serial number into the text box

-The application compares the scanned serial number against a base-line serial number

-Depending on if the serial number is greater, less or equal, a windows messege box is displayed.

I can get the messeage box to work just fine, it's just the line of code that does all the comparision I'm struggling with.

- Serial number to baseline is something like SY1420000134 (all the same charater length and always starts with a SY)

I've been searching for about two hours now and can't find any thread to jog my memory.

View 5 Replies

Getting A Text-box To Compare To More Than One Other?

Jul 4, 2011

Im trying to get a text box the compare its self to more than 1 other ive tried to do it like this :

If TextBox7.Text = TextBox1.Text Or TextBox2.Text Or TextBox3.Text Or TextBox4 Or TextBox5.Text Or TextBox6.Text Then

View 1 Replies

Change Text In A Binary File?

Jun 4, 2011

How do I change bytes [text stored in those bytes] in a binary file?

I have a little function that read bytes 335-343 [For Keyer] and bytes 344-352 [for verifier] and displays it. These bytes store who the keyerID and VerifierID of a data entry file are. From time to time the Verifier Resumes the file [to insert new records], and his/her name gets stored in the KeyerID bytes. So if the original keyer had lots of errors, the new verifier now becomes the owner of this file and the errors are attributed to him/her [not fair]. He/She gets penalized when there are lots of errors.

My question to you is, how do I change the content of those bytes and save it to the file, without damaging any part of the file? I want to save 'H345' in those bytes, [H345 is an example of a Keyer/Verifier ID]

note - as of now I am using 010 Editor [binary editor]to manually change those bytes. When I use this editor, I can see the text portions for those bytes.[code]...

View 1 Replies

Convert Image To Binary Text ?

Jul 22, 2011

converting an image file into binary text in VB 2010.I am working on a compression program and need to see the actual binary as text. I have code for converting text files to binary and it works fine but, need to attempt files with greater randomness that are typically uncompressable.(JPG's) I understand that the file conversions may be huge. I plan on manipulating the binary in smaller manageable chunks.

View 1 Replies

Convert Text To Binary In Program?

Sep 2, 2011

How can i convert a string to binary (8-Bit Binary to be specific) in vb.net?Dim ThnkU as ThankYouNote ThnkU.note="Thanks for your help" ThnkU.Name="Dustin_K" Dim PS as string = "Mark my post

View 4 Replies

From Binary To UTF-16 Text And Vice Versa

Mar 18, 2012

I would like to convert a hexedicimal binary to UTF-16..[code]I am not reading the binary from a file, it is coming as query-string to my website..

View 2 Replies

VS 2010 Convert Text To Binary?

Feb 27, 2011

How? I am willing to make a text to binary to text converter, but how can i convert text to binary?

View 1 Replies

Write Text To A File As A Binary?

Jul 26, 2009

I need to write an hexadecimal value to a text file but as a binary, how do i do that

View 17 Replies

Writing All Text And Translate To Binary?

Jan 25, 2009

I have done a text-to-binary-translator but it only translate one letter at the time, and I want to write a whole text and then translate it to binary

The code now is:
Dim keyin As Integer
keyin = Val(TextBox1.Text)
If TextBox1.Text = "a" Then
TextBox2.Text = 1100001
End If
etc.

It only translate the letter "a" to 1100001. I want to write like "alex" and it would be like
1100001110110011001011111000.

View 14 Replies

.net - Compare Text And Get Differences?

Jul 18, 2011

Well i want to compare 2 strings (version one and version two) and get the differences in a format that i can convert to html on my own, like you can view how a post was edited here on stack*overflow* or like svn tracks differences between revisions....

It must be full managed code library.

Like this JavaScript but i need to do it on the server-side..

View 2 Replies

.net - Compare Three Text Files

Apr 18, 2011

I have a vb.net program in which i must compare three text files(two against one) and verify that they are all same. Even if there is one change i must know where the change is, which text file and which line. The format of the text file is like this

[Code]...

View 1 Replies

Compare Text Box Values With Others?

Mar 29, 2010

Basically i have 12-16 text boxes, with certain values in them.

i think i need a nested loop one to take first box and go through the rest to compare them and then a second loop withint that to do the actual comparison.

View 10 Replies

Use A Validator To Compare 2 Text Box?

Apr 27, 2009

I want to use a validator to compare 2 text box in such a way that ,

If V is in Text box 1, means User must type any of the numbers prefix V in Textbox 2 (V00001 to V00050).Other than V ,if they type any other Letters means error message must be shown.

Just like that if C is in TextBox 1 means user must type C00001 in TextBox2.(or any number from C00001 TO C00050) iF S is in textbox 1 means,User must Type S00001(S00001 TO S00050)

View 1 Replies

More Secure Option Than Text File?

Oct 11, 2009

Im creating a program that stores usernames/passwords for different devices which will require a login to get into the program but I need to save the usernames/passwords somewhere. Is there a more secure way to store this than in a text file? Or I could try encryption which could be quite fun.

View 3 Replies

Text File Amend Option?

Oct 12, 2011

I'm looking for opinions on the safest/best way to append to a text file.These are my two current methods:)

Try
FileOpen(1, RecordingPath & "Log.txt", OpenMode.Append)
PrintLine(1, strAnalogOutput)

[code].....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved