[ASP. NET VB .NET] clientID and ClientID

  • Thread starter Thread starter Maras
  • Start date Start date
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
 
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
 
Back
Top