Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

Adding a Text Box at Run Time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Spaull - 01 Nov 2005 23:25 GMT
I tried posting the following to microsoft.public.vb.controls and was
instructed to try a VBA newsgroup. I tried
microsoft.public.word.vba.userforms but no joy. Can anyone advise as to the
best newsgroup for this sort of question and/or help with this particular
problem.

Using VB 6.3 within Word, I want to add a TextBox control to a UserForm at
run time from within a class module and then handle an AfterUpdate event (or
similar).

I've declared :-

       Private WithEvents LocalTextBox As TextBox

and then added the control as follows :-

       Public Sub AddToForm(Form As UserForm)
           Set LocalTextBox = Form.Controls.Add("Forms.TextBox.1")
           .....

I can then handle certain events (such as the Change event) but an
AfterUpdate event (or similar) is not available.

Where I am going wrong ?
TC - 02 Nov 2005 06:40 GMT
I don't know UserForms, so take this FWIW: are you sure that a textbox
in a userform /does have/ an afterupdate event? Afterupdate sounds more
like an msaccess control event ...

HTH,
TC
Richard Spaull - 02 Nov 2005 23:56 GMT
If you add a TextBox normally to a UserForm in design mode (or whatever it's
called) in Word, then an AfterUpdate event is available. It occurs "after
data in a control is changed through the user interface". However, there
doen't seem to be any such event for the control I'm adding at run time via

       Set LocalTextBox = Form.Controls.Add("Forms.TextBox.1").

Maybe I'm adding a different sort of TextBox - I don't know enough about it
to be sure.

> I don't know UserForms, so take this FWIW: are you sure that a textbox
> in a userform /does have/ an afterupdate event? Afterupdate sounds more
> like an msaccess control event ...
>
> HTH,
> TC
TC - 03 Nov 2005 04:00 GMT
Sorry, I don't know anything about userforms so I can not help you
there.

Good luck,
TC

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.