pls someone should help me to format the date_made and date_expired on my form's datetimepickers to "dd/MM/yyyy" date format.See the code below:

Dim listofdrugs As New List(Of Drug)
        For Each ListItem As ListViewItem In lvDrugs.Items
            'change list item and subitems to drug
            Dim newdrug As New Drug
            With newdrug
                .drug_id = ListItem.Text
                .brand_name = ListItem.SubItems(1).Text
                .date_made = ListItem.SubItems(2).Text
                .date_expired = ListItem.SubItems(3).Text


            End With
            listofdrugs.Add(newdrug)
        Next

And save the list of drugs created on the listview(lvDrug) to my access database(DrugDatabase).Thanks.

In the datetimepicker's properties set the customformat to dd/MM/yyyy, then change the format property to custom. Now when you assign the value to the listview use the datetimepicker.text, and it will have the correct format.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.