I have a function that will change the font, enable, and visible of a ctrl. The issue is that I am getting an Abiguous error message. Looks like several inports has a similar functions.
I use a Label as the passing parameter, which gives an error, and Font. Below is the code, what needs to be corrected to get rid of the errors?
Here are the error codes I'm getting.
I use a Label as the passing parameter, which gives an error, and Font. Below is the code, what needs to be corrected to get rid of the errors?
Code:
Public Sub SetControlState(ByVal lCtrl As Label, ByVal bVisible As Boolean, ByVal bEnabled As Boolean, ByVal nBackClr As Color, Optional bUpdateTxt As Boolean = False, Optional szCtrlText As String = "")
Try
'Change the ctrl text?
If (bUpdateTxt = True) Then
If (szCtrlText = "Yes") Then
lCtrl.ForeColor = Color.Red
lCtrl.Font = New Font(lCtrl.Font, FontStyle.Bold)
Else
lCtrl.ForeColor = Color.Black
If (InStr(lCtrl.Name, "TB_") = 0 And InStr(lCtrl.Name, "LB_") = 0) Then
lCtrl.Font = New Font(lCtrl.Font, FontStyle.Regular)
End If
End If
End If
If (InStr(lCtrl.Name, "SB_") = 0) Then
If (InStr(lCtrl.Name, "BTN_") <> 0) Then
lCtrl.Text = szCtrlText
End If
End If
'If (nBackClr = Color.Red And bVisible = True) Then
' lCtrl.ForeColor = Color.Red
' lCtrl.Font.Bold = New Font(lCtrl.Font, FontStyle.Bold)
'End If
lCtrl.Enabled = bEnabled
lCtrl.Visible = bVisible
Catch ex As Exception
Dim szErr As String
szErr = "Error occured for the following reason [" & ex.Message & "]"
Debug.Print(szErr)
End Try
End Sub
Code:
'Label' is ambiguous, imported from the namespaces or types 'System.Reflection.Emit, Microsoft.Office.Interop.Excel'.
'Font' is ambiguous, imported from the namespaces or types 'Microsoft.Office.Interop.Excel, Microsoft.Office.Interop.Word'.