VB in .net programming: Case sensitive???

  • Thread starter Thread starter J. Muenchbourg
  • Start date Start date
J

J. Muenchbourg

I'm doing a few tests with simple .net scripts, and I noticed that I
display the following error message at ErrMessage.Text if I don't enter
"BLUE" in capital letters into my input textbox:


<%@ Page Language="VB" %>
<script runat="server">

Sub Check_Value(Src As Object, Args As EventArgs)
If Color.Text <> "BLUE" Then
ErrMessage.Text = "ERROR! Please enter the correct word!"
End If
End Sub

</script>


I know C# , derived from the C family, keeps the case sensitive feature
from C, but are references inside <script> blocks case sensitive, even
tho the page language is VB , vbscript, or vb.net ?

Muench
 
The programming language isn't case sensitive.

But you are doing a text comparison here and that always has been case
sensitive. It may be useful to look up the functions upper and lower. (If
Upper(Color.Text) <> "BLUE" Then)

HTH

Yves
 
Hi

You're right C# is case sensitive, but VB.NET is not. You are wrong on the
definition of case sensitive. Case sensitive means that for example the
following 2 lines declare 2 variables (C#):
string myString;
string mySTRING;

In VB.NET you can't write the same:
Dim myString As String
Dim mySTRING As String

This is because VB.NET is not case sensitive, so every statement, variable,
.... can be entered in any case. BUT string values are ofcourse case
sensitive in VB.NET and C#! If you want to make case insensitive
comparisations, you can convert the string values to upper case and compare
them.

Jan
 
Back
Top