473,848 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with "Object reference not set to an instance of an object"

Hi,

I tried to create a class which must change the propety 'visible' of a
<linktag in the masterpage into 'false' when the user is logged. But i get
the error: "Object reference not set to an instance of an object"
for the line 'If mpg.FindControl ("lkred").Visib le = True Then'.

I couldn't find sofar the solution.
Any help would be appreciated ...
Thanks
Chris

the class:
---------
Imports Microsoft.Visua lBasic
Public Class loginkl
Public Sub logkl()
Dim pg As New Page
Dim mpg As MasterPage
If pg.User.Identit y.IsAuthenticat ed = True Then
If mpg.FindControl ("lkred").Visib le = True Then
....
End If
End Sub
End Class

code-behind:
-----------
Partial Class MasterPage
Inherits System.Web.UI.M asterPage
Protected Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Init
Dim lg As New loginkl
lg.logkl()
End Sub
End Class

masterpage.mast er:
------------------
<link runat="server" id="lkred" href="App_Theme s/red.css" rel=Stylesheet
type="text/css" visible="true"/>

Mar 4 '07
35 3259
No scott I am not talking about that.

I had the expirience that in ASPNET this was happening

Select MyField from X.

In Windowsform I "had to" (must) use this when using a non strongly typed
datatable

dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )

You understand that I was confused about that. It was in 1.1

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:ur******** ******@TK2MSFTN GP04.phx.gbl...
Cor, you haven't given any specific example of "something I have tried in
the past", so I can't really speak to it.

The fact is that VB.NET strings ARE case-sensitive, always. This is not
to say that every class treats strings case-sensitively. It's that old
discussion about the difference between the Framework and the language.

As you know, strings are reference types (objects) and so, they are
instanced and stored on the heap. Each string is a different object (with
the exception of interned strings - - different topic) and we are not
talking about evaluating if one string object "IS" the same as another.
We are talking about the value of one string being equivellant to another.
To the CLR, the char "S" is not equivellant to the char "s" - that doesn't
change, ever.

Now, could you run into a class that takes a string as an input value in
one of its methods and could that method deal with that string in a non
case-sensitive way? Sure, but that is a very different thing from saying
that VB.NET strings are not case-sensitive, which is what Chris said:

" it's not case sensitive (VB.net)"
-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:e0******** *****@TK2MSFTNG P06.phx.gbl...
>Scott,

It is something I have tried in past and I don't do it again.
The same code gave errors in windowsforms and was eaten by AspNet.
I found it very strange.

If you don't believe me, does not matter for me, it you keeps you on the
rule than you will never see it.

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:Ok******* *******@TK2MSFT NGP02.phx.gbl.. .
>>>I don't think so Cor,

A string literal is always just that.

You may be referring to situations when you refer to a field name in a
database using a case that does not match the capitalization of the
actual field name.

For example, assume the following SQL statement:

SELECT * From tblCustomers WHERE NAME = "Smith"

It's up to the engine interpreting the strings to decide if it wishes to
enforce case-sensitivity. Many databases do not enforce it on field
names, but do enforce it when querying on a particular value (the WHERE
clause of a SQL statement). In other words, if the field name or string
in the WHERE clause isn't treated case-sensitively, it's because the
database engine processing the SQL statement did it that way, not
because the language the SQL statement was part of (VB.NET, C#, etc.)
isn't case-sensitive.

-Scott

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:ee****** *******@TK2MSFT NGP04.phx.gbl.. .
Scott,

Your message should be true, however, it is not always, it is strange
enough that in AspNet the string literals from ADONET can be mixed uper
and lower case. (I thought I had seen this in version 1.1).

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:uy***** *********@TK2MS FTNGP05.phx.gbl ...
When dealing with string literals (any value in quotes), case always
matters. It's not a VB thing.
>
For example:
>
"Scott" does not equal "scott", so:
>
Dim A As String = "Scott"
Bim B As String = "scott"
>
If A = B Then
MessageBox(A & "= " & B)
Else
MessageBox(A & " <" & B)
End If
>
You will find that the code in the Else always runs.
>
>
>
"Chris" <??**@nospam.dc wrote in message
news:e5**** **********@TK2M SFTNGP03.phx.gb l...
>Hi,
>>
>It's true but it doesn't matter, i thing ... it's not case sensitive
>(VB.net) (i tried with both lower and uppercase).
>Still same error.
>>
>>
>"Stephan y Young" <noone@localhos tschreef in bericht
>news:%2*** *************@T K2MSFTNGP02.phx .gbl...
>>In the masterpage, the id of the control is Lkred and not lkred.
>>>
>>mpg.FindC ontrol("lkred") returns nothing becuase it should be
>>mpg.FindC ontrol("Lkred")
>>>
>>>
>>>
>>"Chris" <??**@nospam.dc wrote in message
>>news:%2** **************@ TK2MSFTNGP06.ph x.gbl...
>>>Hi, thanks to you too. i did what you told me:but i still have the
>>>same error for the same line "'If mpg.FindControl ("lkred").Visib le
>>>= True Then'.
>>>I show you the whole code to be sure ...(i also tried with
>>>Protecte d Sub Page_Load instead of Protected Sub Page_Init).
>>>>
>>>>
>>>masterpa ge:
>>>-----------
>>><head runat="server">
>>> <link runat="server" id="Lkred" href="App_Theme s/red/red.css"
>>>rel=Styl esheet type="text/css" visible="true"/>
>>> <link runat="server" id="lkgreen"
>>>href="Ap p_Themes/green/green.css" rel=Stylesheet type="text/css"
>>>visible= "false" />
>>> </head>
>>>>
>>>classe :
>>>-------
>>>Import s Microsoft.Visua lBasic
>>>>
>>>Public Class loginkl
>>> Public Sub logkl()
>>> Dim pg As New Page
>>> Dim foo As New MasterPage
>>> Dim mpg As MasterPage = foo
>>> If pg.User.Identit y.IsAuthenticat ed = True Then
>>> If mpg.FindControl ("lkred").Visib le = True Then
>>> mpg.FindControl ("lkred").Visib le = False
>>> mpg.FindControl ("lkgreen").Vis ible = True
>>> Else
>>> mpg.FindControl ("lkred").Visib le = True
>>> mpg.FindControl ("lkgreen").Vis ible = False
>>> End If
>>> End If
>>> End Sub
>>>End Class
>>>>
>>>code-behind of masterpage:
>>>---------------------------
>>>Partia l Class MasterPage
>>> Inherits System.Web.UI.M asterPage
>>> Protected Sub Page_Init(ByVal sender As Object, ByVal e As
>>>System.E ventArgs) Handles Me.Init
>>> Dim lg As New loginkl
>>> lg.logkl()
>>> End Sub
>>>End Class
>>>>
>>>
>>
>>
>
>




Mar 9 '07 #21
Cor, this is exactly what I'm describing. I'm not sure why you say you
aren't talking about that.

In your two examples:
dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )
You are passing a string into an indexed property. As you yourself point
out, one example is passing it to a DIFFERENT TYPE than the other. It is
the TYPE that is or isn't enforcing the case-sensitivity, not the VB.NET
language.

You see the difference? There's nothing about your example that would make
the statement: " it's not case sensitive (VB.net)" a true one.

-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:OK******** ******@TK2MSFTN GP03.phx.gbl...
No scott I am not talking about that.

I had the expirience that in ASPNET this was happening

Select MyField from X.

In Windowsform I "had to" (must) use this when using a non strongly typed
datatable

dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )

You understand that I was confused about that. It was in 1.1

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:ur******** ******@TK2MSFTN GP04.phx.gbl...
>Cor, you haven't given any specific example of "something I have tried in
the past", so I can't really speak to it.

The fact is that VB.NET strings ARE case-sensitive, always. This is not
to say that every class treats strings case-sensitively. It's that old
discussion about the difference between the Framework and the language.

As you know, strings are reference types (objects) and so, they are
instanced and stored on the heap. Each string is a different object
(with the exception of interned strings - - different topic) and we are
not talking about evaluating if one string object "IS" the same as
another. We are talking about the value of one string being equivellant
to another. To the CLR, the char "S" is not equivellant to the char "s" -
that doesn't change, ever.

Now, could you run into a class that takes a string as an input value in
one of its methods and could that method deal with that string in a non
case-sensitive way? Sure, but that is a very different thing from saying
that VB.NET strings are not case-sensitive, which is what Chris said:

" it's not case sensitive (VB.net)"
-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:e0******* ******@TK2MSFTN GP06.phx.gbl...
>>Scott,

It is something I have tried in past and I don't do it again.
The same code gave errors in windowsforms and was eaten by AspNet.
I found it very strange.

If you don't believe me, does not matter for me, it you keeps you on the
rule than you will never see it.

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:Ok****** ********@TK2MSF TNGP02.phx.gbl. ..
I don't think so Cor,

A string literal is always just that.

You may be referring to situations when you refer to a field name in a
database using a case that does not match the capitalization of the
actual field name.

For example, assume the following SQL statement:

SELECT * From tblCustomers WHERE NAME = "Smith"

It's up to the engine interpreting the strings to decide if it wishes
to enforce case-sensitivity. Many databases do not enforce it on field
names, but do enforce it when querying on a particular value (the WHERE
clause of a SQL statement). In other words, if the field name or
string in the WHERE clause isn't treated case-sensitively, it's because
the database engine processing the SQL statement did it that way, not
because the language the SQL statement was part of (VB.NET, C#, etc.)
isn't case-sensitive.

-Scott

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:ee***** ********@TK2MSF TNGP04.phx.gbl. ..
Scott,
>
Your message should be true, however, it is not always, it is strange
enough that in AspNet the string literals from ADONET can be mixed
uper and lower case. (I thought I had seen this in version 1.1).
>
Cor
>
"Scott M." <s-***@nospam.nosp amschreef in bericht
news:uy**** **********@TK2M SFTNGP05.phx.gb l...
>When dealing with string literals (any value in quotes), case always
>matters. It's not a VB thing.
>>
>For example:
>>
>"Scott" does not equal "scott", so:
>>
>Dim A As String = "Scott"
>Bim B As String = "scott"
>>
>If A = B Then
> MessageBox(A & "= " & B)
>Else
> MessageBox(A & " <" & B)
>End If
>>
>You will find that the code in the Else always runs.
>>
>>
>>
>"Chris" <??**@nospam.dc wrote in message
>news:e5*** ***********@TK2 MSFTNGP03.phx.g bl...
>>Hi,
>>>
>>It's true but it doesn't matter, i thing ... it's not case sensitive
>>(VB.net ) (i tried with both lower and uppercase).
>>Still same error.
>>>
>>>
>>"Stepha ny Young" <noone@localhos tschreef in bericht
>>news:%2** **************@ TK2MSFTNGP02.ph x.gbl...
>>>In the masterpage, the id of the control is Lkred and not lkred.
>>>>
>>>mpg.Find Control("lkred" ) returns nothing becuase it should be
>>>mpg.Find Control("Lkred" )
>>>>
>>>>
>>>>
>>>"Chris " <??**@nospam.dc wrote in message
>>>news:%2* *************** @TK2MSFTNGP06.p hx.gbl...
>>>>Hi, thanks to you too. i did what you told me:but i still have the
>>>>same error for the same line "'If mpg.FindControl ("lkred").Visib le
>>>>= True Then'.
>>>>I show you the whole code to be sure ...(i also tried with
>>>>Protect ed Sub Page_Load instead of Protected Sub Page_Init).
>>>>>
>>>>>
>>>>masterp age:
>>>>-----------
>>>><head runat="server">
>>>> <link runat="server" id="Lkred" href="App_Theme s/red/red.css"
>>>>rel=Sty lesheet type="text/css" visible="true"/>
>>>> <link runat="server" id="lkgreen"
>>>>href="A pp_Themes/green/green.css" rel=Stylesheet type="text/css"
>>>>visible ="false" />
>>>> </head>
>>>>>
>>>>class e:
>>>>-------
>>>>Impor ts Microsoft.Visua lBasic
>>>>>
>>>>Publi c Class loginkl
>>>> Public Sub logkl()
>>>> Dim pg As New Page
>>>> Dim foo As New MasterPage
>>>> Dim mpg As MasterPage = foo
>>>> If pg.User.Identit y.IsAuthenticat ed = True Then
>>>> If mpg.FindControl ("lkred").Visib le = True Then
>>>> mpg.FindControl ("lkred").Visib le = False
>>>> mpg.FindControl ("lkgreen").Vis ible = True
>>>> Else
>>>> mpg.FindControl ("lkred").Visib le = True
>>>> mpg.FindControl ("lkgreen").Vis ible = False
>>>> End If
>>>> End If
>>>> End Sub
>>>>End Class
>>>>>
>>>>code-behind of masterpage:
>>>>---------------------------
>>>>Parti al Class MasterPage
>>>> Inherits System.Web.UI.M asterPage
>>>> Protected Sub Page_Init(ByVal sender As Object, ByVal e As
>>>>System. EventArgs) Handles Me.Init
>>>> Dim lg As New loginkl
>>>> lg.logkl()
>>>> End Sub
>>>>End Class
>>>>>
>>>>
>>>
>>>
>>
>>
>
>




Mar 9 '07 #22
Scott,

What different type, they are both of the type object?
(it are DataRow Items) which have an index in the column object.

It seems that ASPNET was doing an extra job by setting those columnnames to
upper or lower case, probably as they are more bound to SQL, where the
expressions are as well not case sensitive.

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:uu******** ********@TK2MSF TNGP04.phx.gbl. ..
Cor, this is exactly what I'm describing. I'm not sure why you say you
aren't talking about that.

In your two examples:
>dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )

You are passing a string into an indexed property. As you yourself point
out, one example is passing it to a DIFFERENT TYPE than the other. It is
the TYPE that is or isn't enforcing the case-sensitivity, not the VB.NET
language.

You see the difference? There's nothing about your example that would
make the statement: " it's not case sensitive (VB.net)" a true one.

-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:OK******** ******@TK2MSFTN GP03.phx.gbl...
>No scott I am not talking about that.

I had the expirience that in ASPNET this was happening

Select MyField from X.

In Windowsform I "had to" (must) use this when using a non strongly typed
datatable

dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )

You understand that I was confused about that. It was in 1.1

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:ur******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Cor, you haven't given any specific example of "something I have tried
in the past", so I can't really speak to it.

The fact is that VB.NET strings ARE case-sensitive, always. This is not
to say that every class treats strings case-sensitively. It's that old
discussion about the difference between the Framework and the language.

As you know, strings are reference types (objects) and so, they are
instanced and stored on the heap. Each string is a different object
(with the exception of interned strings - - different topic) and we are
not talking about evaluating if one string object "IS" the same as
another. We are talking about the value of one string being equivellant
to another. To the CLR, the char "S" is not equivellant to the char
"s" - that doesn't change, ever.

Now, could you run into a class that takes a string as an input value in
one of its methods and could that method deal with that string in a non
case-sensitive way? Sure, but that is a very different thing from
saying that VB.NET strings are not case-sensitive, which is what Chris
said:

" it's not case sensitive (VB.net)"
-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:e0****** *******@TK2MSFT NGP06.phx.gbl.. .
Scott,

It is something I have tried in past and I don't do it again.
The same code gave errors in windowsforms and was eaten by AspNet.
I found it very strange.

If you don't believe me, does not matter for me, it you keeps you on
the rule than you will never see it.

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:Ok***** *********@TK2MS FTNGP02.phx.gbl ...
>I don't think so Cor,
>
A string literal is always just that.
>
You may be referring to situations when you refer to a field name in a
database using a case that does not match the capitalization of the
actual field name.
>
For example, assume the following SQL statement:
>
SELECT * From tblCustomers WHERE NAME = "Smith"
>
It's up to the engine interpreting the strings to decide if it wishes
to enforce case-sensitivity. Many databases do not enforce it on
field names, but do enforce it when querying on a particular value
(the WHERE clause of a SQL statement). In other words, if the field
name or string in the WHERE clause isn't treated case-sensitively,
it's because the database engine processing the SQL statement did it
that way, not because the language the SQL statement was part of
(VB.NET, C#, etc.) isn't case-sensitive.
>
-Scott
>
>
>
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:ee**** *********@TK2MS FTNGP04.phx.gbl ...
>Scott,
>>
>Your message should be true, however, it is not always, it is strange
>enough that in AspNet the string literals from ADONET can be mixed
>uper and lower case. (I thought I had seen this in version 1.1).
>>
>Cor
>>
>"Scott M." <s-***@nospam.nosp amschreef in bericht
>news:uy*** ***********@TK2 MSFTNGP05.phx.g bl...
>>When dealing with string literals (any value in quotes), case always
>>matters . It's not a VB thing.
>>>
>>For example:
>>>
>>"Scott" does not equal "scott", so:
>>>
>>Dim A As String = "Scott"
>>Bim B As String = "scott"
>>>
>>If A = B Then
>> MessageBox(A & "= " & B)
>>Else
>> MessageBox(A & " <" & B)
>>End If
>>>
>>You will find that the code in the Else always runs.
>>>
>>>
>>>
>>"Chris" <??**@nospam.dc wrote in message
>>news:e5** ************@TK 2MSFTNGP03.phx. gbl...
>>>Hi,
>>>>
>>>It's true but it doesn't matter, i thing ... it's not case
>>>sensitiv e (VB.net) (i tried with both lower and uppercase).
>>>Still same error.
>>>>
>>>>
>>>"Stephan y Young" <noone@localhos tschreef in bericht
>>>news:%2* *************** @TK2MSFTNGP02.p hx.gbl...
>>>>In the masterpage, the id of the control is Lkred and not lkred.
>>>>>
>>>>mpg.Fin dControl("lkred ") returns nothing becuase it should be
>>>>mpg.Fin dControl("Lkred ")
>>>>>
>>>>>
>>>>>
>>>>"Chri s" <??**@nospam.dc wrote in message
>>>>news:%2 *************** *@TK2MSFTNGP06. phx.gbl...
>>>>>Hi, thanks to you too. i did what you told me:but i still have
>>>>>the same error for the same line "'If
>>>>>mpg.Fi ndControl("lkre d").Visible = True Then'.
>>>>>I show you the whole code to be sure ...(i also tried with
>>>>>Protec ted Sub Page_Load instead of Protected Sub Page_Init).
>>>>>>
>>>>>>
>>>>>master page:
>>>>>-----------
>>>>><hea d runat="server">
>>>>> <link runat="server" id="Lkred" href="App_Theme s/red/red.css"
>>>>>rel=St ylesheet type="text/css" visible="true"/>
>>>>> <link runat="server" id="lkgreen"
>>>>>href=" App_Themes/green/green.css" rel=Stylesheet type="text/css"
>>>>>visibl e="false" />
>>>>> </head>
>>>>>>
>>>>>classe :
>>>>>-------
>>>>>Import s Microsoft.Visua lBasic
>>>>>>
>>>>>Publ ic Class loginkl
>>>>> Public Sub logkl()
>>>>> Dim pg As New Page
>>>>> Dim foo As New MasterPage
>>>>> Dim mpg As MasterPage = foo
>>>>> If pg.User.Identit y.IsAuthenticat ed = True Then
>>>>> If mpg.FindControl ("lkred").Visib le = True Then
>>>>> mpg.FindControl ("lkred").Visib le = False
>>>>> mpg.FindControl ("lkgreen").Vis ible = True
>>>>> Else
>>>>> mpg.FindControl ("lkred").Visib le = True
>>>>> mpg.FindControl ("lkgreen").Vis ible = False
>>>>> End If
>>>>> End If
>>>>> End Sub
>>>>>End Class
>>>>>>
>>>>>code-behind of masterpage:
>>>>>---------------------------
>>>>>Partia l Class MasterPage
>>>>> Inherits System.Web.UI.M asterPage
>>>>> Protected Sub Page_Init(ByVal sender As Object, ByVal e As
>>>>>System .EventArgs) Handles Me.Init
>>>>> Dim lg As New loginkl
>>>>> lg.logkl()
>>>>> End Sub
>>>>>End Class
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Mar 9 '07 #23
It has nothing to do with ASP.NET, since ASP.NET is nothing but a
client/server architecture that is not language dependant.

The two types you talk about are DataSet and Strongly-Typed DataSet, not
just the plain "object" type.

It's clear that Microsoft's standard DataSet requires the column name passed
as an index to the DataRow exactly as the real column name is written. But
a Strongly-Typed DataSet is a different class that inherits from DataSet,
but implements the default property of the DataRow differently. In any
case, we are talking about how the OBJECT expects the parameter, not how
VB.NET (the LANGUAGE) expects it.

Honestly Cor, I know you are smarter than your replies in this particular
topic would lead someone to believe. This is really quite simple.

"If "SCOTT" = "scott" Then" is processed by the CLR, there is no other
object involved here but the String type, so the decision as to whether the
expression is true or not is completely based on the language, which is
VB.NET, which will always return FALSE.

Your entire argument is not based on how the language would treat different
strings, you keep talking about how string data would be accepted by a type
and a type is not the same thing as a language.

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:O5******** ******@TK2MSFTN GP02.phx.gbl...
Scott,

What different type, they are both of the type object?
(it are DataRow Items) which have an index in the column object.

It seems that ASPNET was doing an extra job by setting those columnnames
to upper or lower case, probably as they are more bound to SQL, where the
expressions are as well not case sensitive.

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:uu******** ********@TK2MSF TNGP04.phx.gbl. ..
>Cor, this is exactly what I'm describing. I'm not sure why you say you
aren't talking about that.

In your two examples:
>>dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )

You are passing a string into an indexed property. As you yourself point
out, one example is passing it to a DIFFERENT TYPE than the other. It is
the TYPE that is or isn't enforcing the case-sensitivity, not the VB.NET
language.

You see the difference? There's nothing about your example that would
make the statement: " it's not case sensitive (VB.net)" a true one.

-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:OK******* *******@TK2MSFT NGP03.phx.gbl.. .
>>No scott I am not talking about that.

I had the expirience that in ASPNET this was happening

Select MyField from X.

In Windowsform I "had to" (must) use this when using a non strongly
typed datatable

dim myfield as string = thedatatable.ro ws(0)("MyField" )

in ASPX i could use it as
dim myfield as string = thedatatable.ro ws(0)("mYfIELD" )

You understand that I was confused about that. It was in 1.1

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:ur****** ********@TK2MSF TNGP04.phx.gbl. ..
Cor, you haven't given any specific example of "something I have tried
in the past", so I can't really speak to it.

The fact is that VB.NET strings ARE case-sensitive, always. This is
not to say that every class treats strings case-sensitively. It's that
old discussion about the difference between the Framework and the
language.

As you know, strings are reference types (objects) and so, they are
instanced and stored on the heap. Each string is a different object
(with the exception of interned strings - - different topic) and we are
not talking about evaluating if one string object "IS" the same as
another. We are talking about the value of one string being equivellant
to another. To the CLR, the char "S" is not equivellant to the char
"s" - that doesn't change, ever.

Now, could you run into a class that takes a string as an input value
in one of its methods and could that method deal with that string in a
non case-sensitive way? Sure, but that is a very different thing from
saying that VB.NET strings are not case-sensitive, which is what Chris
said:

" it's not case sensitive (VB.net)"
-Scott


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:e0***** ********@TK2MSF TNGP06.phx.gbl. ..
Scott,
>
It is something I have tried in past and I don't do it again.
The same code gave errors in windowsforms and was eaten by AspNet.
I found it very strange.
>
If you don't believe me, does not matter for me, it you keeps you on
the rule than you will never see it.
>
Cor
>
"Scott M." <s-***@nospam.nosp amschreef in bericht
news:Ok**** **********@TK2M SFTNGP02.phx.gb l...
>>I don't think so Cor,
>>
>A string literal is always just that.
>>
>You may be referring to situations when you refer to a field name in
>a database using a case that does not match the capitalization of the
>actual field name.
>>
>For example, assume the following SQL statement:
>>
>SELECT * From tblCustomers WHERE NAME = "Smith"
>>
>It's up to the engine interpreting the strings to decide if it wishes
>to enforce case-sensitivity. Many databases do not enforce it on
>field names, but do enforce it when querying on a particular value
>(the WHERE clause of a SQL statement). In other words, if the field
>name or string in the WHERE clause isn't treated case-sensitively,
>it's because the database engine processing the SQL statement did it
>that way, not because the language the SQL statement was part of
>(VB.NET, C#, etc.) isn't case-sensitive.
>>
>-Scott
>>
>>
>>
>"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
>news:ee*** **********@TK2M SFTNGP04.phx.gb l...
>>Scott,
>>>
>>Your message should be true, however, it is not always, it is
>>strange enough that in AspNet the string literals from ADONET can be
>>mixed uper and lower case. (I thought I had seen this in version
>>1.1).
>>>
>>Cor
>>>
>>"Scott M." <s-***@nospam.nosp amschreef in bericht
>>news:uy** ************@TK 2MSFTNGP05.phx. gbl...
>>>When dealing with string literals (any value in quotes), case
>>>always matters. It's not a VB thing.
>>>>
>>>For example:
>>>>
>>>"Scott " does not equal "scott", so:
>>>>
>>>Dim A As String = "Scott"
>>>Bim B As String = "scott"
>>>>
>>>If A = B Then
>>> MessageBox(A & "= " & B)
>>>Else
>>> MessageBox(A & " <" & B)
>>>End If
>>>>
>>>You will find that the code in the Else always runs.
>>>>
>>>>
>>>>
>>>"Chris " <??**@nospam.dc wrote in message
>>>news:e5* *************@T K2MSFTNGP03.phx .gbl...
>>>>Hi,
>>>>>
>>>>It's true but it doesn't matter, i thing ... it's not case
>>>>sensiti ve (VB.net) (i tried with both lower and uppercase).
>>>>Still same error.
>>>>>
>>>>>
>>>>"Stepha ny Young" <noone@localhos tschreef in bericht
>>>>news:%2 *************** *@TK2MSFTNGP02. phx.gbl...
>>>>>In the masterpage, the id of the control is Lkred and not lkred.
>>>>>>
>>>>>mpg.Fi ndControl("lkre d") returns nothing becuase it should be
>>>>>mpg.Fi ndControl("Lkre d")
>>>>>>
>>>>>>
>>>>>>
>>>>>"Chris " <??**@nospam.dc wrote in message
>>>>>news:% 2************** **@TK2MSFTNGP06 .phx.gbl...
>>>>>>Hi, thanks to you too. i did what you told me:but i still have
>>>>>>the same error for the same line "'If
>>>>>>mpg.F indControl("lkr ed").Visible = True Then'.
>>>>>>I show you the whole code to be sure ...(i also tried with
>>>>>>Prote cted Sub Page_Load instead of Protected Sub Page_Init).
>>>>>>>
>>>>>>>
>>>>>>maste rpage:
>>>>>>-----------
>>>>>><he ad runat="server">
>>>>>> <link runat="server" id="Lkred" href="App_Theme s/red/red.css"
>>>>>>rel=S tylesheet type="text/css" visible="true"/>
>>>>>> <link runat="server" id="lkgreen"
>>>>>>href= "App_Themes/green/green.css" rel=Stylesheet type="text/css"
>>>>>>visib le="false" />
>>>>>> </head>
>>>>>>>
>>>>>>class e:
>>>>>>-------
>>>>>>Impor ts Microsoft.Visua lBasic
>>>>>>>
>>>>>>Publi c Class loginkl
>>>>>> Public Sub logkl()
>>>>>> Dim pg As New Page
>>>>>> Dim foo As New MasterPage
>>>>>> Dim mpg As MasterPage = foo
>>>>>> If pg.User.Identit y.IsAuthenticat ed = True Then
>>>>>> If mpg.FindControl ("lkred").Visib le = True Then
>>>>>> mpg.FindControl ("lkred").Visib le = False
>>>>>> mpg.FindControl ("lkgreen").Vis ible = True
>>>>>> Else
>>>>>> mpg.FindControl ("lkred").Visib le = True
>>>>>> mpg.FindControl ("lkgreen").Vis ible = False
>>>>>> End If
>>>>>> End If
>>>>>> End Sub
>>>>>>End Class
>>>>>>>
>>>>>>cod e-behind of masterpage:
>>>>>>---------------------------
>>>>>>Parti al Class MasterPage
>>>>>> Inherits System.Web.UI.M asterPage
>>>>>> Protected Sub Page_Init(ByVal sender As Object, ByVal e As
>>>>>>Syste m.EventArgs) Handles Me.Init
>>>>>> Dim lg As New loginkl
>>>>>> lg.logkl()
>>>>>> End Sub
>>>>>>End Class
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Mar 10 '07 #24
"Scott M." <s-***@nospam.nosp amschrieb:
"If "SCOTT" = "scott" Then" is processed by the CLR, there is no other
object involved here but the String type, so the decision as to whether
the expression is true or not is completely based on the language, which
is VB.NET, which will always return FALSE.
This depends on 'Option Compare {Text, Binary}'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Mar 10 '07 #25
True, but that takes us in a different direction from the particulars at
hand.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:OL******** ******@TK2MSFTN GP05.phx.gbl...
"Scott M." <s-***@nospam.nosp amschrieb:
>"If "SCOTT" = "scott" Then" is processed by the CLR, there is no other
object involved here but the String type, so the decision as to whether
the expression is true or not is completely based on the language, which
is VB.NET, which will always return FALSE.

This depends on 'Option Compare {Text, Binary}'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Mar 10 '07 #26
Scott,

My message has nothing to do with the behaviour of the string.

What I am writting about is use of the string as indexer in a not strongly
typed dataset.

I was once supprised that it seems that it seems that they have made in
ASPNET somewhere an unexpected inbuild string.ToUpperc ase (or string to
Lowercase) around AdoNet.

That is all, with that not denying what you wrote, only that there can
sometimes be suprisses.

:-)

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:uu******** *****@TK2MSFTNG P04.phx.gbl...
True, but that takes us in a different direction from the particulars at
hand.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:OL******** ******@TK2MSFTN GP05.phx.gbl...
>"Scott M." <s-***@nospam.nosp amschrieb:
>>"If "SCOTT" = "scott" Then" is processed by the CLR, there is no other
object involved here but the String type, so the decision as to whether
the expression is true or not is completely based on the language, which
is VB.NET, which will always return FALSE.

This depends on 'Option Compare {Text, Binary}'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Mar 10 '07 #27
I hear what you are saying Cor, but you are saying this in a very
mis-leading (and IMHO) incorrect way:

I have been talking all along about the VB.NET language, not how a string
can be passed to a property or method. I have been doing this because of
Chris's first comment about VB.NET not being case-sensitive.


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:O1******** ******@TK2MSFTN GP05.phx.gbl...
Scott,

My message has nothing to do with the behaviour of the string.

What I am writting about is use of the string as indexer in a not strongly
typed dataset.

I was once supprised that it seems that it seems that they have made in
ASPNET somewhere an unexpected inbuild string.ToUpperc ase (or string to
Lowercase) around AdoNet.

That is all, with that not denying what you wrote, only that there can
sometimes be suprisses.

:-)

Cor

"Scott M." <s-***@nospam.nosp amschreef in bericht
news:uu******** *****@TK2MSFTNG P04.phx.gbl...
>True, but that takes us in a different direction from the particulars at
hand.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:OL******* *******@TK2MSFT NGP05.phx.gbl.. .
>>"Scott M." <s-***@nospam.nosp amschrieb:
"If "SCOTT" = "scott" Then" is processed by the CLR, there is no other
object involved here but the String type, so the decision as to whether
the expression is true or not is completely based on the language,
which is VB.NET, which will always return FALSE.

This depends on 'Option Compare {Text, Binary}'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Mar 10 '07 #28
I think the way as you are telling it can be more misleading.

Telling that something has always the same behaviour, while there are
exceptions, can lead that somebody can search for a problem weeks. To
prevent that was the only meaning of my message.

You can answer this message but I don't answer that anymore. Not to be rude,
however because there is enough written and we both will not add new things
anymore

Cor
Mar 11 '07 #29
But, there aren't exceptions and that is my point. The language never
changes the way it handles strings, objects may, but the language doesn't.
To not separate the two things is right up there with those who believe the
Framework is the language and vice versa.


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uu******** ******@TK2MSFTN GP05.phx.gbl...
>I think the way as you are telling it can be more misleading.

Telling that something has always the same behaviour, while there are
exceptions, can lead that somebody can search for a problem weeks. To
prevent that was the only meaning of my message.

You can answer this message but I don't answer that anymore. Not to be
rude, however because there is enough written and we both will not add new
things anymore

Cor

Mar 11 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2758
by: Bob Cannistraci | last post by:
A three-tier user authentication system was running without a problem for almost a year and now is suddenly dysfunctional. We don't know of any changes to any of the servers. It's quite maddening. The details: 1) We know the COM+ app is instanced on the COM+ server (Win 2000). The component graphic spins when CreateObject is called. 2) The proxy is installed on an IIS server (Win 2000) with delivers the interface, written in ASP, to the...
5
6845
by: Tommy Lang | last post by:
Why doesn't the following code work? I get an error at the following line... CardGroup.PropertyCardType = (CardType)0; The error is "Object reference not set to an instance of an object.", which means the object in question have not been initiated. But I have init the object above n this line... public Card CardGroup = new Card; Anybody knows how to resolve this??
3
19727
by: Steve Lutz | last post by:
Hi All, I have a Windows Service that runs well. The service hosts a remote object. The purpose of the object is so that I can "peak" into the service to see what it's doing. I wrote a small Windows Application that connects to the remote object and prints out status information. Everything works fine when I first start the service. However, after some period, when I attempt to connect to the remote object, I get "Requested Service not...
1
2835
by: Chris Magoun | last post by:
I suddenly received an unexpected error in my project. I have been working on this project for some time without this issue. Nothing has changed in the form that caused the exception. A little experimentation shows that I cannot run ANY .NET web project without getting this error: ---------------------------------------------------------------------------- ---- Object reference not set to an instance of an object.
18
28764
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12, FontStyle.Bold), Brushes.Black, 0, 0) Why is this? Marc
1
2298
by: Gummy | last post by:
Hello, I've been banging my head against the wall for a few days on this. When I run a page, either in "View in Browser" or I actually build the solution, I occasionally and very randomly get the following message: Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and...
2
2980
by: louie.hutzel | last post by:
This JUST started happening, I don't remember changing any code: When I click the submit button on my form, stuff is supposed to happen (which it does correctly) and a result message is posted back to the same page at the top of my form alerting the user that their request has been approved or denied. However, the end result is an error message: Error Message: Object reference not set to an instance of an object.
35
2077
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an instance of an object" for the line 'If mpg.FindControl("lkred").Visible = True Then'. I couldn't find sofar the solution. Any help would be appreciated ... Thanks
4
2185
by: My Pet Programmer | last post by:
Ok guys, I'm really looking for someone to tell me how bad a hack this is, and if I'm close to where I should be with it. The basic situation is that I have a class which creates a basic calendar control, the only difference is I stole the navigation scheme from Vista (e.g., if you click on the year you zoom out to the months list, then out to the decade, and back in when you click a year, then a month). I ran into some trouble...
0
9735
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10997
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10661
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10347
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9497
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7067
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5731
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5917
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3172
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.