A
Adam Sandler
Hi all,
I hope this is an easy one... Using VWD 2005. When I call my accessor
method (getName) I always receive an empty string back. Debugging
shows there should be something there but I cannot figure out where the
problem is actually occurring.
The first couple of lines of my code behind:
Partial Class _Default
Inherits System.Web.UI.Page
Dim sName As String ' for getter and setter
Here's my getter and setter:
Function getName()
Return sName
End Function
Sub setName(ByVal s As String)
sName = s
End Sub
Here's the code which calls the setter:
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Try
setName(Me.GridView1.SelectedRow.Cells(2).Text)
Catch nre As NullReferenceException
MsgBox("Please select a row.")
End Try
End Sub
Lastly, here's some code which calls the getter:
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button4.Click
MsgBox(getName())
End Sub
When Button4 is clicked, the message box pops up but there's nothing in
it... where am I going wrong here?
Thanks!
I hope this is an easy one... Using VWD 2005. When I call my accessor
method (getName) I always receive an empty string back. Debugging
shows there should be something there but I cannot figure out where the
problem is actually occurring.
The first couple of lines of my code behind:
Partial Class _Default
Inherits System.Web.UI.Page
Dim sName As String ' for getter and setter
Here's my getter and setter:
Function getName()
Return sName
End Function
Sub setName(ByVal s As String)
sName = s
End Sub
Here's the code which calls the setter:
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Try
setName(Me.GridView1.SelectedRow.Cells(2).Text)
Catch nre As NullReferenceException
MsgBox("Please select a row.")
End Try
End Sub
Lastly, here's some code which calls the getter:
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button4.Click
MsgBox(getName())
End Sub
When Button4 is clicked, the message box pops up but there's nothing in
it... where am I going wrong here?
Thanks!