DropButtonStyle in Textbox created dynamically

wouldbeca

Board Regular
Joined
Aug 31, 2014
Messages
51
Hello all,

I am using below code to add textbox in Page 3 of my userform based on input in textbox( in Page 2.
Code:
Me.MultiPage1.Value = MultiPage1.Value + 1
Dim cSpnEvnt As cControlEvent
    Dim ctlSB As Control
    Dim ctlTXT As Control
    
Dim lngCounter As Long
    
    For lngCounter = 1 To Me.TB_no_of_TB
    On Error GoTo 0
        Set ctlTXT = Me.Frame1.Controls.Add("Forms.Textbox.1", "Text" & lngCounter)
        
        ctlTXT.Name = "Text" & lngCounter
        ctlTXT.Left = 6
        ctlTXT.Height = 25.5: ctlTXT.Width = 150
        ctlTXT.Top = (lngCounter - 1) * 30 + 30


Next lngCounter
    
    Me.Frame1.ScrollHeight = (lngCounter - 1) * 30 + 30
    
    ctlTXT.DropButtonStyle = frmDropButtonStyleplain
    ctlTXT.ShowDropButtonWhen = frmShowDropButtonwhenAlways

I wanted to have a button in the text box ( like in refedit) and found the solution of it through the blog of Jon Peltier
HTML:
http://peltiertech.com/refedit-control-alternative/
where Same can be done by using TextBox.DropButtonStyle & TextBox.ShowDropButtonWhen. But the problem is the same need to be put in user form initialize event, which in my case is not possible as I am inserting textbox in Page 3 after initialising the event. I tried putting it along with ctlTXT at the time of defining properties but its not coming through

Any solution is highly appreciable.
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top