none
2 fold question about date and weeknum in a userform RRS feed

  • Question

  • I have a Userform which enables me to add, update or delete data held on a worksheet ("NLIM_Data"). I am trying to do 2 things.

    1. Have the textbox where the date is added "txtNLIMDate" appear with the correct format as an example "dd/mm/yy" greyed out.

    2. Have the textbox "WeekNum" return the week number of the "txtNLIMDate" textbox.

    Thanks

    Steve

    Wednesday, January 3, 2018 6:15 PM

Answers

  • Hello Steve MW,

    You could add a label and add the "dd/mm/yy" in its text and set forecolor to grey. And then you need set the BackStyle for the textbox as transparent. Put the label and the textbox together. Since the textbox is transparent, you will see the grey text in the label.

    Here is the example.

    In addition, do you have any issue with below thread? If not, I would suggest you mark the helpful reply as answer to close previous threads. If yes, please follow to let us know your current issue.

    Dynamic Lists

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Steve MW Tuesday, January 9, 2018 8:09 PM
    Thursday, January 4, 2018 3:25 AM

All replies

  • Those are different questions. Please, only one question per question.

    I don't understand the first question.

    As for textboxes returning a week number, textboxes cannot do that.



    Sam Hobbs
    SimpleSamples.Info

    Wednesday, January 3, 2018 6:51 PM
  • Sam

    Apologies, i figured as they were both date related I would put them on the same question.

    The first question:

    I am trying to have txtNLIMDate have an input mask. basically I would like the text box to show how the date should be input.


    Steve

    Wednesday, January 3, 2018 7:08 PM
  • I think the MaskedTextBox Class (Microsoft.Office.Tools.Excel.Controls would be the one with a mask.

    However you probably want to use a DateTimePicker or MonthCalendar; I am not sure of the details of them. They both manipulate DateTime objects that can be used to do things like get the week number.



    Sam Hobbs
    SimpleSamples.Info


    • Edited by Simple Samples Wednesday, January 3, 2018 9:29 PM this editor is so frustrating
    Wednesday, January 3, 2018 9:28 PM
  • Hello Steve MW,

    You could add a label and add the "dd/mm/yy" in its text and set forecolor to grey. And then you need set the BackStyle for the textbox as transparent. Put the label and the textbox together. Since the textbox is transparent, you will see the grey text in the label.

    Here is the example.

    In addition, do you have any issue with below thread? If not, I would suggest you mark the helpful reply as answer to close previous threads. If yes, please follow to let us know your current issue.

    Dynamic Lists

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Steve MW Tuesday, January 9, 2018 8:09 PM
    Thursday, January 4, 2018 3:25 AM