Difference Between UserForm in Excel VBA and the Form in VB

A

ALEX

Hi There,


I am migrating a VB form/code into Excel VBA UserForm/module but it seems that they are different.

Particularly in a VBA UserForm, a textbox Control does not support CLEAR method.


So the following code works in VB but not in VBA:

' Clear the error log display.
Form2.lstErrors.Clear


(lstErrors is a txtbox control)


Any ideas?

thanks,
Alex
 
R

Rob Bovey

Hi Alex,

Yes, there are many differences between VB Forms and their controls and
VBA UserForms and their controls. To clear a VBA TextBox you just set its
Text property to an empty string:

txtMyTextBox.Text = ""

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


Hi There,


I am migrating a VB form/code into Excel VBA UserForm/module but it seems
that they are different.

Particularly in a VBA UserForm, a textbox Control does not support CLEAR
method.


So the following code works in VB but not in VBA:

' Clear the error log display.
Form2.lstErrors.Clear


(lstErrors is a txtbox control)


Any ideas?

thanks,
Alex
 
N

NickHK

Alex,
A text box never had a "Clear" method.
Given the name of the control begins with "lst" and you want the "Clear" method, I'd say it wsa a list box not a text box.

NickHK
Hi There,


I am migrating a VB form/code into Excel VBA UserForm/module but it seems that they are different.

Particularly in a VBA UserForm, a textbox Control does not support CLEAR method.


So the following code works in VB but not in VBA:

' Clear the error log display.
Form2.lstErrors.Clear


(lstErrors is a txtbox control)


Any ideas?

thanks,
Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top