Student Details Program

The Student Details program uses UDT or User Defined Type. So you can learn about creating UDT and using them. This is a very simple program with some text fields of student details. You can learn how to access member variables of the UDT. Download the program and learn using UDT in your code.

                                                   >> DOWNLOAD

using UDT

'Sub structure of UDT
Private Type AddressDetails
    city As String
    state As String
    pin As Long
    ph_no As String
End Type
Private Type StudentDetails
    name As String
    stream As String
    DepartmentId As String
    address As AddressDetails
End Type
Private Sub cmdShow_Click()
    Dim student1 As StudentDetails

    'Nested With...End With structure
    With student1
        .name = Text1(0).Text
        .stream = Text1(1).Text
        .DepartmentId = Text1(2).Text
        MsgBox .name & vbTab & .stream & vbTab & .DepartmentId, vbInformation, "Info 1"
        With .address
            .city = Text1(3).Text
            .state = Text1(4).Text
            .pin = Val(Text1(5).Text)
            .ph_no = Text1(6).Text
            MsgBox .city & vbTab & .state & vbTab & .pin & vbTab & .ph_no, vbInformation, "info 2"
        End With
    End With

End Sub