locked
Error 1 Overload resolution failed because no accessible '=' can be called with these arguments:

    Question

  • Hi im trying to create a if else loop but i keep getting this message:

    Error 1 Overload resolution failed because no accessible '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean': Value of type 'System.Web.UI.WebControls.TextBox' cannot be converted to 'String'. C:\Documents and Settings\username\My Documents\Visual Studio 2005\WebSites\WebSite3\ManagerPage.aspx.vb 20 13 C:\...\WebSite3\

     

    What does this means?? Anyway to solve it. Thanks...

    Tuesday, June 12, 2007 8:55 AM

Answers

  • Without looking at the code, I can't say for sure, but from the error it looks like you're probably trying to compare a textbox to a string, instead of the textbox's Text property.

     

    If that's not the problem, please post the relevant part of your code.

     

    HTH,

    --Jeff

    Tuesday, June 12, 2007 4:20 PM

All replies

  • Without looking at the code, I can't say for sure, but from the error it looks like you're probably trying to compare a textbox to a string, instead of the textbox's Text property.

     

    If that's not the problem, please post the relevant part of your code.

     

    HTH,

    --Jeff

    Tuesday, June 12, 2007 4:20 PM
  •  

    Im having the same issue, but im making a login form

     

    Public Class LoginForm1

    Dim Username As String 'Username Variable

    Dim Password As String 'Password Variable

    Private Sub OK_Click()

    Username = "ks1" 'What the Username Variable is

    Password = "TestUser1" 'What the Password Variable is

    'If Statement Starting Here

    'It States that if the username is = to text box and password is = password text box, then it should login, else display error message!

    If Username = txtUser And Password = txtPass Then

    Else

    'A Message box that displays you have entered the wrong username and password

    MsgBox("You have entered the wrong username and password")

    End If

    End Sub

     

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click

    Me.Close()

    End Sub

    Private Sub LogoPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoPictureBox.Click

    End Sub

    End Class

    Monday, May 12, 2008 5:50 AM
  •  dshd wrote:

    If Username = txtUser And Password = txtPass Then

     

    This is the code with the error.  Username is a String but txtUser is a TextBox!  You cannot compare a String and a TextBox.  You must compare the String against the TextBox's .Text property.  The same is true of Password and txtPass.  To fix it, change your code like this:

     

    Code Snippet

    If Username = txtUser.Text AndAlso Password = txtPass.Text Then

     

     

     

    Do yourself a favor.  Open the properties for your project and on the Compile tab, set Option Strict On.

     

    Chris

    Monday, May 12, 2008 6:05 PM
  • Hello guys,

    I also have the same error.

    verload resolution failed because no Public '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean':
            Argument matching parameter 'a' cannot convert from '__ComObject' to 'String'.
       at Microsoft.VisualBasic.CompilerServices.OverloadResolution.ResolveOverloadedCall(String MethodName, List`1 Candidates, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, Boolean ReportErrors, ResolutionFailure& Failure)
       at Microsoft.VisualBasic.CompilerServices.Operators.ResolveUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments, Boolean ReportErrors)
       at Microsoft.VisualBasic.CompilerServices.Operators.InvokeUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments)
       at Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare)
       at CDOMessaging.ExchangeConnector.Logon(String profile, String RootFolder)
       at InFaxAlert.InFaxAlert.OnWakeup2(Object sender, ElapsedEventArgs e)


    This is the function

          
    Public Sub Logon(ByVal profile As StringByVal RootFolder As String
     
            m_Session = New MAPI.Session 
            m_Session.Logon(profile, , False, , , , ) 
     
            ' Go the fax store 
            Dim Folders As String() = RootFolder.Split("/".ToCharArray())        
            Dim strID As String 
            Dim PropTag As Long = &H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID 
            Dim i As Integer = 1 
     
            m_InfoStores = m_Session.InfoStores 
            For i = 1 To m_InfoStores.Count 
                If m_InfoStores.Item(i) = Folders(0) Then 
                    m_PublicFolderRoot = m_InfoStores.Item(i) 
                    Exit For 
                End If 
            Next 
     
            strID = m_PublicFolderRoot.Fields(PropTag) 
            Dim Parent As MAPI.Folder = m_PublicFolderRoot.GetFolder(strID, m_PublicFolderRoot.ID) 
             
            For i = 1 To Folders.Length - 1 
                Parent = GetFolderByName(Folders(i), Parent) 
            Next 
            m_FaxRoot = Parent 
     
        End Sub 


    Please help. TY :D

    JAN

    Newbie
    Wednesday, September 17, 2008 5:17 AM
  • Hello guys,

    I also have the same error.

    verload resolution failed because no Public '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean':
            Argument matching parameter 'a' cannot convert from '__ComObject' to 'String'.
       at Microsoft.VisualBasic.CompilerServices.OverloadResolution.ResolveOverloadedCall(String MethodName, List`1 Candidates, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, Boolean ReportErrors, ResolutionFailure& Failure)
       at Microsoft.VisualBasic.CompilerServices.Operators.ResolveUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments, Boolean ReportErrors)
       at Microsoft.VisualBasic.CompilerServices.Operators.InvokeUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments)
       at Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare)
       at CDOMessaging.ExchangeConnector.Logon(String profile, String RootFolder)
       at InFaxAlert.InFaxAlert.OnWakeup2(Object sender, ElapsedEventArgs e)


    This is the function

          
    Public Sub Logon(ByVal profile As StringByVal RootFolder As String
     
            m_Session = New MAPI.Session 
            m_Session.Logon(profile, , False, , , , ) 
     
            ' Go the fax store 
            Dim Folders As String() = RootFolder.Split("/".ToCharArray())        
            Dim strID As String 
            Dim PropTag As Long = &H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID 
            Dim i As Integer = 1 
     
            m_InfoStores = m_Session.InfoStores 
            For i = 1 To m_InfoStores.Count 
                If m_InfoStores.Item(i) = Folders(0) Then 
                    m_PublicFolderRoot = m_InfoStores.Item(i) 
                    Exit For 
                End If 
            Next 
     
            strID = m_PublicFolderRoot.Fields(PropTag) 
            Dim Parent As MAPI.Folder = m_PublicFolderRoot.GetFolder(strID, m_PublicFolderRoot.ID) 
             
            For i = 1 To Folders.Length - 1 
                Parent = GetFolderByName(Folders(i), Parent) 
            Next 
            m_FaxRoot = Parent 
     
        End Sub 


    Please help. TY :D

    JAN

    Newbie
    Wednesday, September 17, 2008 5:17 AM
  • Hello guys,

    I also have the same error.

    verload resolution failed because no Public '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean':
            Argument matching parameter 'a' cannot convert from '__ComObject' to 'String'.
       at Microsoft.VisualBasic.CompilerServices.OverloadResolution.ResolveOverloadedCall(String MethodName, List`1 Candidates, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, Boolean ReportErrors, ResolutionFailure& Failure)
       at Microsoft.VisualBasic.CompilerServices.Operators.ResolveUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments, Boolean ReportErrors)
       at Microsoft.VisualBasic.CompilerServices.Operators.InvokeUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments)
       at Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare)
       at CDOMessaging.ExchangeConnector.Logon(String profile, String RootFolder)
       at InFaxAlert.InFaxAlert.OnWakeup2(Object sender, ElapsedEventArgs e)


    This is the function

          
    Public Sub Logon(ByVal profile As StringByVal RootFolder As String
     
            m_Session = New MAPI.Session 
            m_Session.Logon(profile, , False, , , , ) 
     
            ' Go the fax store 
            Dim Folders As String() = RootFolder.Split("/".ToCharArray())        
            Dim strID As String 
            Dim PropTag As Long = &H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID 
            Dim i As Integer = 1 
     
            m_InfoStores = m_Session.InfoStores 
            For i = 1 To m_InfoStores.Count 
                If m_InfoStores.Item(i) = Folders(0) Then 
                    m_PublicFolderRoot = m_InfoStores.Item(i) 
                    Exit For 
                End If 
            Next 
     
            strID = m_PublicFolderRoot.Fields(PropTag) 
            Dim Parent As MAPI.Folder = m_PublicFolderRoot.GetFolder(strID, m_PublicFolderRoot.ID) 
             
            For i = 1 To Folders.Length - 1 
                Parent = GetFolderByName(Folders(i), Parent) 
            Next 
            m_FaxRoot = Parent 
     
        End Sub 


    Please help. TY :D

    JAN

    Newbie
    Wednesday, September 17, 2008 5:18 AM
  • Hello guys,

    I also have the same error.

    verload resolution failed because no Public '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean':
            Argument matching parameter 'a' cannot convert from '__ComObject' to 'String'.
       at Microsoft.VisualBasic.CompilerServices.OverloadResolution.ResolveOverloadedCall(String MethodName, List`1 Candidates, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, Boolean ReportErrors, ResolutionFailure& Failure)
       at Microsoft.VisualBasic.CompilerServices.Operators.ResolveUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments, Boolean ReportErrors)
       at Microsoft.VisualBasic.CompilerServices.Operators.InvokeUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments)
       at Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare)
       at CDOMessaging.ExchangeConnector.Logon(String profile, String RootFolder)
       at InFaxAlert.InFaxAlert.OnWakeup2(Object sender, ElapsedEventArgs e)


    This is the function

          
    Public Sub Logon(ByVal profile As StringByVal RootFolder As String
     
            m_Session = New MAPI.Session 
            m_Session.Logon(profile, , False, , , , ) 
     
            ' Go the fax store 
            Dim Folders As String() = RootFolder.Split("/".ToCharArray())        
            Dim strID As String 
            Dim PropTag As Long = &H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID 
            Dim i As Integer = 1 
     
            m_InfoStores = m_Session.InfoStores 
            For i = 1 To m_InfoStores.Count 
                If m_InfoStores.Item(i) = Folders(0) Then 
                    m_PublicFolderRoot = m_InfoStores.Item(i) 
                    Exit For 
                End If 
            Next 
     
            strID = m_PublicFolderRoot.Fields(PropTag) 
            Dim Parent As MAPI.Folder = m_PublicFolderRoot.GetFolder(strID, m_PublicFolderRoot.ID) 
             
            For i = 1 To Folders.Length - 1 
                Parent = GetFolderByName(Folders(i), Parent) 
            Next 
            m_FaxRoot = Parent 
     
        End Sub 


    Please help. TY :D

    JAN

    Newbie
    Wednesday, September 17, 2008 5:22 AM
  • Hello guys,

    I also have the same error.

    verload resolution failed because no Public '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean':
            Argument matching parameter 'a' cannot convert from '__ComObject' to 'String'.
       at Microsoft.VisualBasic.CompilerServices.OverloadResolution.ResolveOverloadedCall(String MethodName, List`1 Candidates, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, Boolean ReportErrors, ResolutionFailure& Failure)
       at Microsoft.VisualBasic.CompilerServices.Operators.ResolveUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments, Boolean ReportErrors)
       at Microsoft.VisualBasic.CompilerServices.Operators.InvokeUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments)
       at Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare)
       at CDOMessaging.ExchangeConnector.Logon(String profile, String RootFolder)
       at InFaxAlert.InFaxAlert.OnWakeup2(Object sender, ElapsedEventArgs e)


    This is the function

          
    Public Sub Logon(ByVal profile As StringByVal RootFolder As String
     
            m_Session = New MAPI.Session 
            m_Session.Logon(profile, , False, , , , ) 
     
            ' Go the fax store 
            Dim Folders As String() = RootFolder.Split("/".ToCharArray())        
            Dim strID As String 
            Dim PropTag As Long = &H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID 
            Dim i As Integer = 1 
     
            m_InfoStores = m_Session.InfoStores 
            For i = 1 To m_InfoStores.Count 
                If m_InfoStores.Item(i) = Folders(0) Then 
                    m_PublicFolderRoot = m_InfoStores.Item(i) 
                    Exit For 
                End If 
            Next 
     
            strID = m_PublicFolderRoot.Fields(PropTag) 
            Dim Parent As MAPI.Folder = m_PublicFolderRoot.GetFolder(strID, m_PublicFolderRoot.ID) 
             
            For i = 1 To Folders.Length - 1 
                Parent = GetFolderByName(Folders(i), Parent) 
            Next 
            m_FaxRoot = Parent 
     
        End Sub 


    Please help. TY :D

    JAN

    Newbie
    Wednesday, September 17, 2008 5:22 AM
  • Hello guys,

    I also have the same error.

    verload resolution failed because no Public '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean':
            Argument matching parameter 'a' cannot convert from '__ComObject' to 'String'.
       at Microsoft.VisualBasic.CompilerServices.OverloadResolution.ResolveOverloadedCall(String MethodName, List`1 Candidates, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, Boolean ReportErrors, ResolutionFailure& Failure)
       at Microsoft.VisualBasic.CompilerServices.Operators.ResolveUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments, Boolean ReportErrors)
       at Microsoft.VisualBasic.CompilerServices.Operators.InvokeUserDefinedOperator(UserDefinedOperator Op, Object[] Arguments)
       at Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare)
       at CDOMessaging.ExchangeConnector.Logon(String profile, String RootFolder)
       at InFaxAlert.InFaxAlert.OnWakeup2(Object sender, ElapsedEventArgs e)


    This is the function

          
    Public Sub Logon(ByVal profile As StringByVal RootFolder As String
     
            m_Session = New MAPI.Session 
            m_Session.Logon(profile, , False, , , , ) 
     
            ' Go the fax store 
            Dim Folders As String() = RootFolder.Split("/".ToCharArray())        
            Dim strID As String 
            Dim PropTag As Long = &H66310102 ' PR_IPM_PUBLIC_FOLDERS_ENTRYID 
            Dim i As Integer = 1 
     
            m_InfoStores = m_Session.InfoStores 
            For i = 1 To m_InfoStores.Count 
                If m_InfoStores.Item(i) = Folders(0) Then 
                    m_PublicFolderRoot = m_InfoStores.Item(i) 
                    Exit For 
                End If 
            Next 
     
            strID = m_PublicFolderRoot.Fields(PropTag) 
            Dim Parent As MAPI.Folder = m_PublicFolderRoot.GetFolder(strID, m_PublicFolderRoot.ID) 
             
            For i = 1 To Folders.Length - 1 
                Parent = GetFolderByName(Folders(i), Parent) 
            Next 
            m_FaxRoot = Parent 
     
        End Sub 


    Please help. TY :D

    JAN

    Newbie
    Wednesday, September 17, 2008 5:23 AM