Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an ilogic that I trying to take an price *number of profil * length of profil
when I just calculate price *number of profil it work fine , but my code stop working as soon as I try to add the length of profil.. the code fail. I have no idear of why...
Public Sub Main() Dim NameList As New ArrayList() Dim IsRHS As Boolean = False Dim wrongDisplayname As String Dim Tocopypast As String Dim oAsmDoc As AssemblyDocument Dim Antal oAsmDoc = ThisApplication.ActiveDocument Dim oRefDocs As DocumentsEnumerator oRefDocs = oAsmDoc.AllReferencedDocuments Dim oRefDoc As Document NameList.Add("3116030034") NameList.Add("3116040043") NameList.Add("3116040044") NameList.Add("3116030053") NameList.Add("3116030054") NameList.Add("3116050053") NameList.Add("3116050054") NameList.Add("3116050055") NameList.Add("3116050056") NameList.Add("3116050058") NameList.Add("3116040063") NameList.Add("3116040064") NameList.Add("3116030064") NameList.Add("3116060064") NameList.Add("3116060065") NameList.Add("3116060066") NameList.Add("3116040084") NameList.Add("3116040085") NameList.Add("3116040086") NameList.Add("3116050084") NameList.Add("3116050085") NameList.Add("3116080065") NameList.Add("3116080083") NameList.Add("3116080084") NameList.Add("3116080085") NameList.Add("3116080086") NameList.Add("3116080088") NameList.Add("3116090098") NameList.Add("3116050103") NameList.Add("3116050104") NameList.Add("3116050106") NameList.Add("3116050108") NameList.Add("3116060103") NameList.Add("3116060106") NameList.Add("3116080104") NameList.Add("3116080106") NameList.Add("3116100104") NameList.Add("3116100105") NameList.Add("3116100106") NameList.Add("3116100108") NameList.Add("3116100109") NameList.Add("3116060124") NameList.Add("3116060125") NameList.Add("3116060126") NameList.Add("3116060128") NameList.Add("3116060129") NameList.Add("3116080125") NameList.Add("3116080126") NameList.Add("3116120125") NameList.Add("3116120128") NameList.Add("3116120130") NameList.Add("3116140150") NameList.Add("3116075156") NameList.Add("3116100155") NameList.Add("3116100156") NameList.Add("3116100158") NameList.Add("3116100159") NameList.Add("3116080164") NameList.Add("3116080165") NameList.Add("3116080166") NameList.Add("3116080168") NameList.Add("3116080169") NameList.Add("3116160168") NameList.Add("3116180180") NameList.Add("3116100205") NameList.Add("3116100206") NameList.Add("3116100208") NameList.Add("3116100210") NameList.Add("3116120206") NameList.Add("3116200206") NameList.Add("3116150256") NameList.Add("3116100308") NameList.Add("3116100310") NameList.Add("3116200410") NameList.Add("3116400410") For Each oRefDoc In oRefDocs For Each rawmaterial In NameList Try If iProperties.Value(oRefDoc.DisplayName, "Custom", "Raw Material") = rawmaterial Then IsRHS = True assemblyDoc = oAsmDoc assemblyDef = assemblyDoc.ComponentDefinition Antal = assemblyDef.Occurrences.AllReferencedOccurrences(oRefDoc) Length = iProperties.Value(oRefDoc.DisplayName, "Custom", "G_L") MsgBox(iProperties.Value(oRefDoc.DisplayName, "Custom", "G_L")) 'debug("Length " & Length.ToString ) price = Antal.Count * 42 '* Length debug(iProperties.Value(oRefDoc.DisplayName, "Project", "Part Number") & " " & "number of unit " & Antal.Count.ToString & " Money Save by change to RHP " & price & " kr") End If Catch IsRHS = False End Try Next If IsRHS = True Then If iProperties.Value(oRefDoc.DisplayName, "Custom", "Raw Material") <> "" Then debug(iProperties.Value(oRefDoc.DisplayName,"Project", "Part Number")) wrongDisplayname = wrongDisplayname & vbLf & vbLf & "Partnumber " & iProperties.Value(oRefDoc.DisplayName, "Project", "Part Number") Tocopypast = Tocopypast & iProperties.Value(oRefDoc.DisplayName, "Project", "Part Number") & " OR " Clipboard.SetText(Tocopypast) IsRHS = False End If End If Next MessageBox.Show(wrongDisplayname, "Use RHS material") End Sub Public Sub debug(txt As String) Trace.WriteLine("NTI : " & txt) End Sub
Solved! Go to Solution.