• 0

[VB.NET] How to converted a value of


Question

Hey,

How to converted a value of textbox into a String??

Here the full code:

   Public Property Name_textbox() As String
        Get
            Return TextBox1
        End Get
        Set(ByVal value As String)

        End Set
    End Property
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        My.Resources.Name = Name_textbox()
    End Sub

But I get this error :

Value of type 'System.Windows.Forms.TextBox' cannot be converted to 'String'.

Thanks :D

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
? ? ? Get
 ? ? ? ? ? Return TextBox1
 ? ? ? End Get

You're returning TextBox1 when you should be returning Tex(Y)x1.Text (Y)

Thanks gameguy &am:p Winston :p

Link to comment
Share on other sites

  • 0
And it's rather silly why you're making a property to get the text when the Text Box cotrol provides that property itself which is .text haha.

His TextBox may be private, who knows? :whistle:

It is kinda funny though ;)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.