none
Message Box Error

    Question

  • I am learning to program and the book i read has made me create a small application whereby you type your name in a textbox and submit and press a button to bring up a message box that says ("Hello" + text input in textbox). It works fine but my message box doesnt say, "Hello Chayce," but "Hello System.Windows.Controls.TextBox: Chayce." How do i fix this?

    Thanks


    • Edited by Chayce Ross Sunday, January 03, 2016 3:34 PM
    Sunday, January 03, 2016 3:28 PM

Answers

  • My guess is you used something like

    MessageBox.Show("Hello" & TextBox1.ToString)

    which outputs this:

    You should use

    MessageBox.Show("Hello" & TextBox1.Text.ToString)

    which does this:

    All in all just a typo you forgot .Text :)


    Cyrille Precetti Bonne Année! Happy New Year!


    Sunday, January 03, 2016 3:48 PM

All replies

  • My guess is you used something like

    MessageBox.Show("Hello" & TextBox1.ToString)

    which outputs this:

    You should use

    MessageBox.Show("Hello" & TextBox1.Text.ToString)

    which does this:

    All in all just a typo you forgot .Text :)


    Cyrille Precetti Bonne Année! Happy New Year!


    Sunday, January 03, 2016 3:48 PM
  • Sorry I see i will add the extra part
    Sunday, January 03, 2016 3:55 PM
  • Thanks

    Sunday, January 03, 2016 3:57 PM