Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hello

 

Do you want to read the last line to display it? Assuming you take my last example to write the file, you can read and display the last line like this:

 

Imports System.IO

Dim strFile As String = "C:\Temp\Log.txt"
Dim sr As Streamreader
Try
   If File.Exists(strFile) Then
      sr = System.IO.File.OpenText(strFile)
   End If
   MsgBox(File.ReadLines(strFile).Last())
   sr.Close()
Catch ex As IOException
   MsgBox("Error reading logfile.")
End Try

 

 

 

 You should use the BOM (model view) instead the browser pane. The browser pane have a lot of nodes that are irrelevant and need to be identified and filtered out. You have to "solve" occurrence patterns (count visible occurrences) by yourself. That's all not necessary in the BOM. You can traverse the same way as the browser pane by looping through every BOMrow and get the referenced document.  Then you can check the the BOM structure (Phantom/Normal) of this row and get the quantity of the assembly/part in the assembly one level above. If the BOMrow has ChildRows you can dive down a level. Optional you can commit the quantity ByVal and multiplicate it with the item quantity in the sublevel. This way you get the absolute quantity with respect to the main assembly.

I would divide as per BOM structure Normal weldment/Phantom weldment/ Others in three different dictionaries and collect there each FullFileName and quantity. Every key in a dictionary is unique, so you can (in a try-catch) try to add a key/value pair and if it throws an error (cause an entry with the same key already exists) sum up the new quantity to the existing entry in the catch.

At the end you will have 3 dictionaries with the counts you need and no further calculating needed. You can also use this dictionaries to copy your files in your folder structure.

 


R. Krieg
RKW Solutions
www.rkw-solutions.com