BUG: DBCombo Does Not Display the "&" Character Correctly (176873)
The information in this article applies to:
- Microsoft Visual Basic Control Creation Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
This article was previously published under Q176873 SYMPTOMS
If a DBCombo control contains items with the ampersand (&) character as
part of the text and if the style of the DBCombo control is
dbcDropdownList, then the text will not display correctly in the text box
portion (the edit area) of the control. The drop-down list area is not
affected.
This problem does not occur with the styles dbcDropdownCombo or
dbcSimpleCombo.
RESOLUTION
To work around this problem, simply modify the text to include an extra "&"
for every "&" that is in the original text as shown in the following code:
Private Sub DBCombo1_Click(Area As Integer)
Dim i As Integer
Dim s As String
Dim c As String * 1
If DBCombo1.Style = dbcDropdownList And Area = dbcAreaList Then
s = DBCombo1.Text
If InStr(s, "&") Then
DBCombo1.Text = ""
For i = 1 To Len(s)
c = Mid$(s, i, 1)
If c = "&" Then
DBCombo1.Text = DBCombo1.Text & "&&"
Else
DBCombo1.Text = DBCombo1.Text & c
End If
Next
End If
End If
End Sub
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products
listed at the beginning of this article. We are researching this
bug and will post new information here in the Microsoft Knowledge
Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbbug KB176873 |
---|
|