[ASP. NET VB .NET] clientID and ClientID

M

Maras

Hello,

as we know VB is not case sensivity. I have a following problem,
I have to send to another server few parametrs by post or get method,
one of them MUST be a "clientID", it's preety simple, but in VB .NET
there is a property ClientID and I get an error, a conflict beetwen
my clientID and ClientID of MyBase class

aspx code:
****
[...]
<form action="page2.aspx" runat="server" method="post">
<input type="text" id="clientID">
<input type="submit" value="Submit">
</form>
[...]
****

aspx.vb code
****
[...]
Protected clientID As System.Web.UI.HtmlControls.HtmlInputText

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
clientID.Value = "i have to do something with this value here"
End Sub
[...]
****

Haw can I solve this problem? In c# this works (case sensivity).
Thanks
Cheers
 
C

Cowboy \(Gregory A. Beamer\)

It is not a wise idea, from a CLI standpoint, to have two variables named
the same thing but altered by case only. There is no real way around it, as
this is an aspect of the VB.NET language to keep it "more compatible" with
VB 6.

For base classes, you can "hide" (Shadow) the base implementation and then
call it through a fully qualified call. For example:

Public Class MyBaseClass
Public ClientID As String
End Class

Public Class MyDerivedClass
Inherits MyBaseClass
Protected clientID As System.Web.UI.HtmlControls.HtmlInputText

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MyBase.clientID.Value = "i have to do something with this value here"
End Sub

End Class

This allows you to access the base implementation, but may not solve your
problem completely. Consider a re-architecture if you are naming values the
same thing in different layers, as you will run into problems.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
Maras said:
Hello,

as we know VB is not case sensivity. I have a following problem,
I have to send to another server few parametrs by post or get method,
one of them MUST be a "clientID", it's preety simple, but in VB .NET
there is a property ClientID and I get an error, a conflict beetwen
my clientID and ClientID of MyBase class

aspx code:
****
[...]
<form action="page2.aspx" runat="server" method="post">
<input type="text" id="clientID">
<input type="submit" value="Submit">
</form>
[...]
****

aspx.vb code
****
[...]
Protected clientID As System.Web.UI.HtmlControls.HtmlInputText

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
clientID.Value = "i have to do something with this value here"
End Sub
[...]
****

Haw can I solve this problem? In c# this works (case sensivity).
Thanks
Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,192
Latest member
KalaReid2

Latest Threads

Top