Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error message Property access must assign to the property or use its

Status
Not open for further replies.

officemanager2

Technical User
Oct 11, 2007
116
CA
Hello: Below is an example from the Visual Basic.net for complete beginners
and that is what I am. This is from the third chapter and everything was
going fine until the exercise to create a third text box that would input the
result of WholeName based on the FirstName LastName text boxes. The code to
put the result in a message box is straight forward but putting the result
into a text box is proving problematic.

Code:
Public Class Form1

    Private Sub StringTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combine.Click

  
        Dim FirstName As String
        Dim LastName As String
        Dim WholeName As String

        FirstName = txtFirstName.Text
        LastName = txtLastName.Text
        WholeName = FirstName & " " & LastName



    End Sub

    Public Property WholeName() As String

        Get
            Return WholeName
        End Get
        Set(ByVal WholeName As String)

        End Set
    End Property
End Class

The error is

Property access must assign to the property or use its value.

I've looked up this error and it seems that others have had the same problem
and those good at working with VB.net say the issue is straight forward but
I'm no further along with a solution or understanding the full extent of the
problem.

What I can put together I need to turn this class into a method, but this was
not covered in the chapter so I'm not sure what the author was thinking.
Either way I'll keep reviewing what I find on line, but if anyone has some
tips/direction I'm open to learn.

thanks
 
Ok, here is what works

Code:
Public Class Form1

    Private Sub Combine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combine.Click


        Dim FirstName As String
        Dim LastName As String
        Dim WholeName As String

        FirstName = txtFirstName.Text
        LastName = txtLastName.Text
        WholeName = FirstName & " " & LastName
        txtFullName.Text = WholeName


    End Sub

  
End Class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top