Question Date-Time Format

DeepsB

New member
Joined
Feb 21, 2020
Messages
2
Programming Experience
Beginner
Hi,

I am new to programming and have just started programming in vb.net.
I want to populated a dropdown list with different date formats like DD-MM-YYYY, YYYY-MM-DD, MM-DD-YYYY. I want these formats either to appear in Caps or all small for User. Once the date format is selected by the user, I want to show todays date in that date format on a label. As month has to be given in caps and date and year in small for changing the date format it doesn't work. I didn't find any other property of Dropdown in which I can give Date format in dd-MM-yyyy, yyyy-MM-dd, MM-dd-yyyy. How to do this?

DeepsB
 
Last edited:
I want to do this for windows application not web Application.
Then you probably ought not to have posted in the Web Forms forum. Thread moved.

If you post in the Web Forms forum and say "dropdown list" then people will assume that you're using a DropDownList control in a Web Forms app. If you're actually using a ComboBox control in a Windows Forms app, that's what you ought to say.
 
You need to make a list of objects that have two properties: one for the displayed format and one for the used format. That could be instances of an anonymous type, a Tuple or your own dedicated type. The last option is probably the one to go for if you're a beginner. You define the type, create the objects, populate the list and then bind it to the ComboBox, setting the DisplayMember and ValueMember to the names of your two properties.
 
Back
Top