Microsoft KB Archive/191205

= BUG: Run-Time Error 458 When Late-Binding Rich TextBox Control =

Article ID: 191205

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q191205



SYMPTOMS
When you access the BackColor property of a Rich TextBox Control that is late-bound, the following error occurs when you run the program:

Error 458: Variable uses an Automation type not supported in Visual Basic.



RESOLUTION
Instead of late-binding the control, try to early-bind it. For example, you can replace the following code:

Dim ctl As Control Set ctl = RichTextBox1

with:

Dim ctl As RichTextBox Set ctl = RichTextBox1



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.



Steps to Reproduce Behavior
 Create a new Standard EXE project in Visual Basic. Form1 is created by default. Select Components from the Project menu, browse for the Microsoft Rich TextBox Control 6.0, and select it. Add the control to Form1.  Paste the following code into the code window of Form1: Private Sub Form_Load Dim ctl As Control Set ctl = RichTextBox1 ctl.BackColor = vbRed If ctl.BackColor <> vbRed Then MsgBox "fail" End If     End Sub

 Press F5 to run the project.

RESULTS: The following error appears:

Error 458: Variable uses an Automation type not supported in Visual Basic

Keywords: kberrmsg kbbug kbctrl kbpending kbcode KB191205

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.