Use variable values in class.

S

Shapper

Hello,

My aspx.vb file code is as follows:

Public Class _aspxgrid_template
Inherits System.Web.UI.Page
...
Private Sub Page_Load(...) Handles MyBase.Load
...
Dim var1 As String = "A"
Dim var2 As String = "B"
Dim var3 As String = "C"
column.ItemTemplate = CreateItemTemplate()
...
End Sub

Function CreateItemTemplate() As ITemplate
Return New ItemTemplate
End Function

End Class

In my ItemTemplate class I use some constants.
Instead of using constants how can I use var1, var2 and var3 values?

Thank You,
Miguel
 
M

Mr Newbie

Not quite sure what you are getting at, but this might be what you are after
as it replaces a constant with a property but makes It read only

Public Class Class1

Private m_var1 As String

Public ReadOnly Property var1() As String

Get

Return m_var1

End Get

End Property

End Class
 
L

Lucas Tam

In my ItemTemplate class I use some constants.
Instead of using constants how can I use var1, var2 and var3 values?

You need to expose the variables a public properties.
 

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

Top