Results 1 to 7 of 7

Thread: Please help on UDT changes..

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2008
    Posts
    265

    Question Please help on UDT changes..

    Hi everyone! I'm having a little problem in applying changes to UDT like below. I really have no idea

    vb Code:
    1. Option Explicit
    2.  
    3. Private Type ProductUDT
    4.     Name         As String
    5.     Description  As String
    6. End Type
    7.  
    8. Dim Products() As ProductUDT, i As Long
    9. Dim FileLoc As String
    10.  
    11.  
    12. Private Sub cmdDelete_Click()
    13.     List1.RemoveItem List1.ListIndex
    14.        
    15.     'After the ListIndex removal, then what about the UDT??
    16.        
    17.     Form_Load  'Update list
    18. End Sub
    19.  
    20. Private Sub cmdAddNew_Click()
    21.     'What to do with the UDT changes?
    22.     '???
    23.  
    24.     Form_Load  'Update list
    25. End Sub
    26.  
    27. Private Sub Form_Load()
    28.     Dim Itm     As String
    29.     Dim Desc    As String
    30.     Dim counter As Integer
    31.    
    32.     List1.Clear
    33.     FileLoc = App.Path & "\thefile.txt"
    34.    
    35.     Open FileLoc For Input As #1
    36.          Do Until EOF(1)
    37.             counter = counter + 1
    38.             Input #1, Itm, Desc
    39.            
    40.             ReDim Preserve Products(1 To counter)
    41.            
    42.             Products(counter).Name = Itm
    43.             Products(counter).Description = Desc
    44.          Loop
    45.     Close
    46.      
    47.  
    48.     For i = LBound(Products) To UBound(Products)
    49.         List1.AddItem Products(i).Name
    50.         List1.ItemData(List1.NewIndex) = i
    51.     Next
    52.    
    53.     Me.Caption = "Total Item : " & List1.ListCount
    54. End Sub
    55.  
    56. Private Sub List1_Click()
    57.     i = List1.ItemData(List1.ListIndex)
    58.    
    59.     lblDescription.Caption = "Description: " & vbNewLine & _
    60.                               Products(i).Description
    61. End Sub

    What should I do to save/ apply the changes made. Many thanks
    Last edited by vibiEn; Aug 2nd, 2008 at 07:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width