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.


.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 View Related

.net Vs Vb6 Pros And Cons?

Feb 13, 2007

i am a seasoned vb6 and 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 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 View Related

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 View Related

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 View Related

.net - 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 namespace. What are the pro/cons of these two ways, or is there a another way that I am missing?


View 1 Replies View Related

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 View Related

.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 View Related

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 View Related

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 View Related

Compare Date - Compare Textbox1 And Textbox2 Text

Mar 3, 2010

I have two textbox in my application.


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 View Related

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 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 View Related

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:



View 4 Replies View Related

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 View Related

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


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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

Convert Text To Binary In Program?

Sep 2, 2011

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

View 4 Replies View Related

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 View Related

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 View Related

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 View Related

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

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

View 14 Replies View Related

.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 View Related

.net - Compare Three Text Files

Apr 18, 2011

I have a 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


View 1 Replies View Related

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 View Related

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 View Related

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 View Related

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:)

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


View 2 Replies View Related

VS 2008 : Get A Msgbox With Some Text And A Yes And No Option?

May 11, 2009

I want a msgbox with some text, and a Yes and No option..Why wont this code work?

MsgBoxStyle.YesNo ("TEXT")

View 10 Replies View Related

Reading Binary File As Text And Manipulating It

Sep 29, 2010

I am doing some exercises on encrypting data. One of them are binary files. I am currently using triple DES to encrypt and decrypt the files both in VB.NET and C#... Now the thing is, once it is decrypted in VB.NET and saved, I can execute it again... But for some reason, my C# file is bigger! 20,4K where VB.NET one is 19,0. The C# file also is rendered unexecutable...Upon a closer look. The files appear almost exactly the same, but C# seems to add in a few extra bytes here and there in (seemingly) random places... I am currently using:
File.ReadAllText(String filepath, Encoding encoding); with UTF-8 encoding.

View 1 Replies View Related

Should Change File From Binary To Text Or Another Type

Apr 20, 2011

i am currently doing a project for my course. My project is creating a system for a mechanical workshop, this includes customer information, car information, expenditure ect. I am not allowed to use access to store the information as this will decrease my overall mark on difficulty hence i am going to use files to store the information. I am using VB 2005. I have tried with binary files, this was good at first as it stored data in a record but then when i tried to create a algorithm to search the data it failed.

1) Should i change my file from binary to text or another type?

2) Anyone have any ideas to search within a binary file? If you do can i get some code please.

View 2 Replies View Related

Set Option Explicit And Option Strict On A Project / Solution Level?

Feb 22, 2011

I really like the coding speed that provides, but I don't like the possibility to forget to declare variable types, return types of functions, etc. and that is why in each class I use[code]..

Is there a way to define those two options on the project/solution level?

View 2 Replies View Related

The Combo Box Style 1 Has Both The Drop Down Option But Also A Manual Entry Option

Jan 26, 2010

the combo box style 1 has both the drop down option but also a manual entry option. I need to know how to code it so that when you manually enter data, it takes that data and places it in a text message "The shipping charges for "data" is $15" displaying in a text box. Shouldn't be hard but have developed a mind block.

View 4 Replies View Related

App To Compare Data From Various Text Files

Dec 7, 2010

I've been tasked with writing an app that reads in various text files(.csv, .txt) in different formats with different delimiters.I then need to compare certain data in these files and report the differences.There are a couple of columns that are common between the files, but they aren't in the same place, and there is inconsistent and unnecessary header info.There is extra data(columns) in these files that I don't need.Should I parse these files into a datatable? Should I create an object for each file type to format the data and get rid of the unnecessary info?I'm not sure about the best way to tackle this problem. 

View 1 Replies View Related

App To Compare Data In Various Text Files?

Dec 7, 2010

I have been tasked with creating an app that will read in various text files(.csv, .txt) and compare some of the data contained within.

I thought I would read in the files and convert them to datatables. Once I had them in a datatable I figured I could remove the unnecessary rows/columns and then sort and compare the pertinent info for differences. The difficulty is that the various files are formatted differently so I will need to get each type formatted correctly. Is this the best approach?

I have read in a .csv, parsed it into a datatable, but I'm having trouble with the logic/coding to get rid of the rows and columns that I don't need. Also, I'm not sure how to handle a row that has a cell with a comma seperated list of values that will need to be split into individual rows.

View 1 Replies View Related

Compare Values From Two Text File?

Jul 20, 2009

I have two text files which contains are like this[code]..

When the original files find the same values in drill file than it must overwrite the original file the line from drill file. Let say original file contain T230 than it must serch for same value in drill file if it find than it must overwrite the original file line with drill file line. The content of drill file is not fix. It will allways be update according to need.

is that posible to connect two text file?

View 4 Replies View Related

Compare Values In Text Boxes?

May 20, 2009

Is there a way to compare values in text boxes?

For example, if I have two text boxes, I want to compare the numbers in each to see which is higher and then commit actions if one if higher.

View 4 Replies View Related

Get A Code For Compare Between 2 Text Files A.txt And B.txt?

Mar 17, 2010

i want a code for compare between 2 text files A.txt and B.txt all record in file B.txt includes in file A.txt but with different value.the digits with color red are accounts and the digits with color blue are values.i want to compare between A.txt and B.txt based on accounts,when find the accounts from B.txt in A.txt copy the full record for these accounts from A.txt and print it in new file C.txt

File A.txt:
ABC20100317201000000 -----> Header


View 2 Replies View Related

Copyrights 2005-15, All rights reserved