Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: DropButtonStyle in Textbox created dynamically

  1. #1
    New Member
    Join Date
    Aug 2014
    Posts
    39
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation DropButtonStyle in Textbox created dynamically

    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 Code:
    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 by wouldbeca; Feb 3rd, 2017 at 01:54 AM.

  2. #2
    MrExcel MVP
    Join Date
    May 2003
    Location
    USA
    Posts
    4,386
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: DropButtonStyle in Textbox created dynamically

    You've misspelled the constants:

    Code:
        ctlTXT.DropButtonStyle = fmDropButtonStyleplain
        ctlTXT.ShowDropButtonWhen = fmShowDropButtonwhenAlways
    fmWhatever, not frmWhatever.

    Also, why didn't you directly link to the tutorial? It's Alternative to Excel’s Flaky RefEdit Control.
    Jon Peltier
    Peltier Technical Services, Inc.
    Try Peltier Tech Charts for Excel

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com