|
-
May 7th, 2009, 08:37 AM
#1
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:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As String = Inputbox("Enter your username")
TextBox1.Text = result
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.
-
May 7th, 2009, 09:06 AM
#2
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 -
-
May 7th, 2009, 02:35 PM
#3
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.
-
May 7th, 2009, 02:39 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|