Posts by tienphamsd

    Re: Label caption doesn't display on userform after update using Class modules


    Thanks Logit and Pike for your input!
    I finally got it to work by just starting from scratch again.


    However, when I tried to reuse it in the workbook I've been working on it went right back to the same problem I was previously having. That is that the Label caption wasn't displaying on the UserForm.
    So, I apparently was having two separate issues...


    For the sake of other readers, so that they don't make the same mistake I did.
    I found the second issue to be in how I was calling the userform. I originally had a button on the worksheet that called a macro to run various other tasks before it called the userform.


    I don't recall why I originally wrote it this way, but the example below shows how I was calling it...as opposed to the much simpler way that actually works properly:


    (Doesn't work)

    Code
    Sub RunUserFrom()        
    	Dim myUserform As UserForm1
            Set myUserform = New UserForm1
            myUserform.Show
    End Sub


    (Does Work)

    Code
    Sub RunUserForm()        
    	UserForm1.Show
    End Sub


    Thanks again both for helping me figure this out! I've been banging my head against the wall over this for days now...Haha.

    Re: Label caption doesn't display on userform after update using Class modules


    Hi Logit. Thanks for the reply.
    Unfortunately that only works if I write that code for every textbox I would have in the userform. So if I had say 20 textboxes, I would have to include a sub for each of them. Creating the Class module eases that as it let's me use just a few lines of code to step thru all of the textboxes at once. It seems to work as when I include a MsgBox, that pops up every time I make a change in the textboxes. So, I know that it calls the sub PersistentUpdate_ItemNumber()...there just seems to be a problem with it displaying the caption after it's changed.

    Hello,


    I have a userform that will have multiple text boxes for users to edit data pulled from one of the Sheets.
    In that userform I have corresponding labels for each text box to show the number of characters each has.
    I want each respective label to update their caption to be displayed as the user is editing each text box.


    The method I have come across to do this is by using a Class module.
    However, I am having an issue with the label caption not displaying on the userform.
    The below code is an example of the code I'm using on just a single text box and single corresponding label named ItemNumber and ItemNumberLength respectively:


    Class Module:



    Userform1:



    Thanks in advance!