Nick Riggi
Nick Riggi

Reputation: 49

'text' is ambiguous - ERROR (vb.net)

I am trying to make a set homepage button for my webbrowser, using this code:

    Private Sub UpdateHomePage(ByVal UrlString As Text)
      Form1.WebBrowser1.Url = New System.Uri(UrlString.Tostring)
      IO.File.WriteAllText(Environment.SpecialFolder.ApplicationData & "\Homepage.Info",         UrlString)
    End Sub

On this part: Private Sub UpdateHomePage(ByVal UrlString As Text), it has an error: 'Text' is ambiguous, imported from the namespaces or types 'System, System.Drawing'.

I have been trying to solve this for days now, and this is my last resort.

Upvotes: 1

Views: 1593

Answers (1)

vcsjones
vcsjones

Reputation: 141703

The problem is:

UpdateHomePage(ByVal UrlString As Text)

The Text word is a type, which is there to indicate what UrlString is. Types can be organized into namespaces. You can have two types of the same name as long as they are in different namespaces. However, when two namespaces are imported, the compiler is confused about which Text type it should use, so you get the error you are getting. It may also be confusing it with the namespace System.Text.

But as rob pointed out in a comment, you probably didn't mean to use Text. In VB.NET, text data is represented by the String type, so this is probably what you wanted:

Private Sub UpdateHomePage(ByVal UrlString As String)

If you really meant a type of Text, you just need to fully qualify the type name with the namespace.

Upvotes: 4

Related Questions