2 Replies Latest reply on Apr 20, 2017 5:53 PM by Norbert Gal

    Detect, decide if BOM changed? VB.NET

    Norbert Gal



      In my application I read a full content of a BOM, and store it's data in DataTable.

      User can switch window, can manipulate what he want, but when he switch back to BOM's window, I have to decide if a BOM changed or not based on my last full content reading (content, row order etc).

      Is there some fast way to decide or detect this?

      Full read is not good option, because in case of large modell there is a lot of times.


      Thank you

        • Re: Detect, decide if BOM changed? VB.NET
          Norbert Gal

          I found something, and I can store a full "stamp" of a BOM in a variable with this method:

          - I can write the table's contentt to a template file with this function: 2013 SOLIDWORKS API Help - SaveAsText Method (ITableAnnotation)

          - I read back this template file, and store it's text in a variable

          - delete template file


          Now I can compare anytime if a BOM changed or not.


          The big question, can I directly send the content to a variable instead of a file?

          The SaveAsText method needs an input as FileName (full path), can I somehow redirect it to a variable?

            • Re: Detect, decide if BOM changed? VB.NET
              Norbert Gal

              I didn't find a solution to redirect SaveAsText uotput to variable, so I use filewrite/read method like in code below.


              • readFileByLine is my function what gives back List(Of String) object based on reading a text file line by line
              • tablePrevious is a Public String object


              Function CheckTable()

              Dim result As Boolean = False

              Dim fileName As String = "C:\tempbomtocheck.txt"


              Dim saveAsResult = myTable.SaveAsText(fileName, ";")

              Dim currentTable As String = String.Join(vbNewLine, readFileByLine(fileName))


              If tablePrevious IsNot Nothing Then

                  result = (tablePrevious = currentTable)

              End If


              tablePrevious = currentTable


              Return result

              End Function