Results 1 to 4 of 4

Thread: Inputbox problem.

  1. #1

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Inputbox problem.

    Hi All,

    I have a wierd problem with an Inputbox.
    Who I have not in VB 2003 and 2008.


    If I try this:

    vb.net Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim result As String = Inputbox("Enter your username")
    3.         TextBox1.Text = result
    4.     End Sub

    Then I've got this error:

    'Inputbox' is a namespace and cannot be used as an expression.
    Do I need to show an Inputbox in a different way than in vb 2003 or 2008.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Inputbox problem.

    That's because you have a naming conflict somewhere in yuor project (a namespace with the name "Inputbox" that you referenced or created yourself).
    To verify it, use the fully qualified name of the inputbox function and you won't see the error
    Code:
    Dim result As String = Microsoft.VisualBasic.InputBox("Enter your username")
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Inputbox problem.

    Hi stanav,

    Thanks for the answer, it worked.

    I have still a question about that.
    Why it does work with the code in my first post in vb 2008 and not in the older version (2005) of VB.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Inputbox problem.

    Did you name the project itself inputbox??

    whatever you call your project, is also used as the default root namespace of the project.

    That could cause it. Otherwise as stanav said, you made a custom namespace somewhere in the code, and called it inputbox.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width