Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8346823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:08:58+00:00 2026-06-09T07:08:58+00:00

I am basically creating a list of items that are generated at runtime. The

  • 0

I am basically creating a list of items that are generated at runtime. The items are listed on a userform as labels(the items are stored in a linked list). With each item, I want to add a spinbutton so I can move the items up and down the list. I the spinbuttons are created just fine, the events I have coded do not work?? I am not sure what I am doing wrong. Probably something simple…

This is the class module to hold the events: cls_Spin_Btn

Private WithEvents Spin_Events As SpinButton

Private Sub Spin_Events_SpinUp()

    Debug.Print "Hey. Spin button worked."

End Sub

Public Property Set SetNewSpinButtion(newSpinBtn As MSForms.SpinButton)

    Set Spin_Events = newSpinBtn

End Property

This is code is calling from a module:

Function AddRunToForm(f As UserForm, r As ProductionRun, top As Integer) As Integer

Dim Run_SpinBtn As MSForms.SpinButton
Dim spinBtn As cls_Spin_Btn

Set Run_SpinBtn = f.Controls.Add("Forms.SpinButton.1", r.ProdID & "_SBtn", True)
Set spinBtn = New cls_Spin_Btn

With Run_SpinBtn

    .top = ProdID_Lbl.top
    .Left = 5
    .height = 10
    .Width = 12
    .height = 18
    .Visible = True

End With

Set spinBtn.SetNewSpinButtion = Run_SpinBtn

AddRunToForm = ProdID_Lbl.top + ProdID_Lbl.height

End Function

This code is called from a loop in the same module creating labels and spinbuttons for each item. What am I doing wrong? Any help would be very much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:08:59+00:00Added an answer on June 9, 2026 at 7:08 am

    In your userform code module, put this

    Private mcolSpinButtons As Collection
    
    Public Property Get SpinButtonCollection() As Collection
    
        If mcolSpinButtons Is Nothing Then Set mcolSpinButtons = New Collection
    
        Set SpinButtonCollection = mcolSpinButtons
    
    End Property
    

    That will give you access to a module level variable that will stay in scope as long as your userform is open. When you put cls_Spin_Btn instances in that collection, they will also stay in scope.

    Then in your function, once you create the new spin button class instance, add it to the collection

    f.SpinButtonCollection.Add spinBtn, spinBtn.Name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I want is like this creating variable names from an array list
The way I know how to represent a linked list is basically creating a
I just need help. Basically I am creating a windows appllication that sends bulk
I am creating an application that basically places a drawable into an imageView onClick.
So i have been creating this framework thing that basically puts together source code
I am having problems creating a table in python. Basically I want to build
The short story: I want to convert a list/dictionary into an anonymous object Basically
I'm creating an application that basically downloads and uploads files from various types of
I'm creating a server control that basically binds two dropdown lists, one for country
I am creating a website for ads. I want to have a list like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.