Sunday, June 2, 2019

ETABS2016 PLUG-IN OBJECT SELECTOR









VB net packaging include the following:





References:


Please take note of ETABS 2016.dll as the reference



VB NET dPlug-in Code:



Public Class cPlugin

    Private Shared modality As String = "Non-Modal"

    Friend Shared VersionString As String = "Version " _
                                            & System.Reflection.Assembly.GetExecutingAssembly.GetName().Version.ToString _
                                            & " , .NET Only , Compiled as " _
                                            & System.Reflection.Assembly.GetExecutingAssembly.GetName().ProcessorArchitecture.ToString _
                                            & " , " & modality

    Public Function Info(ByRef Text As String) As Integer

        Try
            Text = Text & "Disclaimer: " & vbCrLf
            Text = Text & "No Liability is accepted by its software authors for any direct, indirect, consequential or incidental loss or damage arising out of the software "
            Text = Text & "use or any mistakes and negligence in developing this software.  The organisation or person using the software bears all risks and "
            Text = Text & "responsibility for the quality and performance of the software.  "
            Text = Text & "" & vbCrLf & vbCrLf
            Text = Text & "Limitation:" & vbCrLf
            Text = Text & "The software is limit to ETABS 2016 version."
            Text = Text & "" & vbCrLf & vbCrLf
            Text = Text & "Your Usage:" & vbCrLf
            Text = Text & "The software is intended to help you save time and effort in calculations. :"
            Text = Text & " Please check and validate all results carefully.  You are responsible and liable for all consequences of its use."
            Text = Text & vbCrLf & vbCrLf
            Text = Text & "Software Distribution Policy:"
            Text = Text & "You can freely use this product for your personal or business design work.  This product  however remains our copyright. "
            Text = Text & "You may also reproduce and distribute it provided that each copy shall be a true and complete copy, "
            Text = Text & " including all copyright and trademark notices and that such distribution shall not be for commercial purposes."
            Text = Text & vbCrLf & vbCrLf
            Text = Text & "Technical Support and Contacting Us:" & vbCrLf
            Text = Text & "We welcome and value all comments and suggestions via email.    However,  we do not provide formal technical support."
            Text = Text & " As and when possible, your comments will be used to improve our software in the future.  Your feedback is very important to us.  For feedback and/or donation please email at: "
            Text = Text & vbCrLf & vbCrLf & vbCrLf
            Text = Text & "     Email: ernel_filipinas@yahoo.com"
            Text = Text & vbCrLf & vbCrLf
            Text &= VersionString
        Catch ex As Exception
        End Try

        Return 0

    End Function

    Public Sub Main(ByRef SapModel As cSapModel, ByRef ISapPlugin As cPluginCallback)

        Dim aForm As New Form1

        Try
            aForm.setParentPluginObject(Me)
            aForm.setSapModel(SapModel, ISapPlugin)

            If StrComp(modality, "Non-Modal", CompareMethod.Text) = 0 Then
                ' Non-modal form, allows graphics refresh operations in CSI program, 
                ' but Main will return to CSI program before the form is closed.
                aForm.Show()
            Else
                ' Modal form, will not return to CSI program until form is closed,
                ' but may cause errors when refreshing the view.
                aForm.ShowDialog()
            End If

            ' It is very important to call ISapPlugin.Finish(iError) when form closes, !!!
            ' otherwise, CSI program will wait and be hung !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            ' this must be done inside the closing event for the form itself, not here !!!

            ' if you simply have algorithmic code here without any forms, 
            ' then call ISapPlugin.Finish(iError) here before returning to CSI program

            ' if your code will run for more than a few seconds, you should exercise
            ' the Windows messaging loop to keep the program responsive. You may 
            ' also want to provide an opportunity for the user to cancel operations.

        Catch ex As Exception
            MsgBox("The following error terminated the Plugin:" & vbCrLf & ex.Message)

            ' call Finish to inform CSI program that the PlugIn has terminated
            Try
                ISapPlugin.Finish(1)
            Catch ex1 As Exception
            End Try
        End Try

        Return

    End Sub

    Protected Overrides Sub Finalize()
        MyBase.Finalize()
    End Sub
End Class



VB NET cVectorFont Code:


Public Class cVectorFont
    Public Enum TextAlignment
        kTA_HLeft = 0
        kTA_HCenter
        kTA_HRight
        kTA_VBottom
        kTA_VCenter
        kTA_VTop
    End Enum

    Protected Const VF_CHARACTERS As Integer = 96
    Protected Const VF_MOVES_PER_CHARACTER As Integer = 20
    Protected Const VF_ASPECT_RATIO As Double = 0.5

    Structure VFData
        Dim XI As Double
        Dim YI As Double
        Dim pen As Integer
    End Structure

    'std::vector > vf;
    Protected vf(,) As VFData

    Public Sub New()
        ReDim vf(VF_CHARACTERS + 1, VF_CHARACTERS + 1)

        Initialize()
    End Sub

    Protected Sub Initialize()
        Dim VectorChar(97) As String, tmpString As String
        Dim i As Integer, j As Integer, k As Integer
        VectorChar(1) = "923 000"
        VectorChar(2) = "323 422 343 442 462 572 482 382 272 362 342 923 000"
        VectorChar(3) = "383 272 262 162 172 272 683 572 562 462 472 572 923 000"
        VectorChar(4) = "133 172 573 532 643 042 063 662 923 000"
        VectorChar(5) = "133 532 642 552 152 062 172 572 383 322 923 000"
        VectorChar(6) = "163 262 372 282 182 072 162 573 132 423 522 632 542 442 332 422 923 000"
        VectorChar(7) = "623 172 282 482 472 052 032 122 422 532 632 923 000"
        VectorChar(8) = "483 372 362 262 272 372 923 000"
        VectorChar(9) = "683 472 252 232 412 602 923 000"
        VectorChar(10) = "283 472 652 632 412 203 923 000"
        VectorChar(11) = "333 372 563 142 053 652 543 162 923 000"
        VectorChar(12) = "333 372 053 652 923 000"
        VectorChar(13) = "213 322 332 232 222 322 923 000"
        VectorChar(14) = "053 652 923 000"
        VectorChar(15) = "223 322 332 232 222 923 000"
        VectorChar(16) = "682 923 000"
        VectorChar(17) = "123 522 632 672 582 182 072 032 122 133 572 923 000"
        VectorChar(18) = "323 522 423 482 372 923 000"
        VectorChar(19) = "173 282 582 672 662 032 022 622 923 000"
        VectorChar(20) = "033 122 522 632 642 552 352 553 662 672 582 282 172 923 000"
        VectorChar(21) = "423 622 523 582 042 642 923 000"
        VectorChar(22) = "033 122 522 632 642 552 152 182 582 923 000"
        VectorChar(23) = "583 262 152 042 032 122 522 632 642 552 152 923 000"
        VectorChar(24) = "023 682 182 072 923 000"
        VectorChar(25) = "123 522 632 642 452 252 162 172 282 482 572 562 452 253 042 032 122 923 000"
        VectorChar(26) = "023 442 662 672 582 182 072 062 152 552 923 000"
        VectorChar(27) = "223 322 332 232 222 253 352 362 262 252 923 000"
        VectorChar(28) = "213 322 332 232 222 322 253 352 362 262 252 923 000"
        VectorChar(29) = "533 152 572 923 000"
        VectorChar(30) = "143 542 563 162 923 000"
        VectorChar(31) = "043 452 062 352 042 923 000"
        VectorChar(32) = "223 322 243 342 352 562 572 482 182 072 923 000"
        VectorChar(33) = "553 542 342 352 552 662 572 272 062 032 222 522 632 923 000"
        VectorChar(34) = "052 382 652 622 043 642 923 000"
        VectorChar(35) = "082 482 572 562 452 552 642 632 522 022 053 452 923 000"
        VectorChar(36) = "573 482 182 072 032 122 522 632 923 000"
        VectorChar(37) = "082 582 672 632 522 022 923 000"
        VectorChar(38) = "082 582 353 052 023 622 923 000"
        VectorChar(39) = "082 682 453 052 923 000"
        VectorChar(40) = "353 552 642 632 522 122 032 072 182 482 572 923 000"
        VectorChar(41) = "082 053 652 683 622 923 000"
        VectorChar(42) = "123 522 323 382 183 582 923 000"
        VectorChar(43) = "033 122 422 532 582 383 682 923 000"
        VectorChar(44) = "082 053 352 683 352 622 923 000"
        VectorChar(45) = "083 022 622 923 000"
        VectorChar(46) = "082 352 682 622 923 000"
        VectorChar(47) = "082 622 682 582 923 000"
        VectorChar(48) = "033 072 182 582 672 632 522 122 032 923 000"
        VectorChar(49) = "082 582 672 662 552 052 923 000"
        VectorChar(50) = "033 072 182 582 672 632 522 122 032 343 432 622 923 000"
        VectorChar(51) = "082 582 672 662 552 052 453 442 622 923 000"
        VectorChar(52) = "033 122 522 632 642 552 152 062 072 182 482 572 923 000"
        VectorChar(53) = "323 382 083 682 923 000"
        VectorChar(54) = "083 032 122 522 632 682 923 000"
        VectorChar(55) = "083 052 322 652 682 923 000"
        VectorChar(56) = "083 022 352 622 682 923 000"
        VectorChar(57) = "682 083 622 923 000"
        VectorChar(58) = "323 352 082 683 352 923 000"
        VectorChar(59) = "083 682 022 622 253 452 923 000"
        VectorChar(60) = "423 222 282 482 923 000"
        VectorChar(61) = "083 622 923 000"
        VectorChar(62) = "223 422 482 282 923 000"
        VectorChar(63) = "153 372 552 923 000"
        VectorChar(64) = "013 612 923 000"
        VectorChar(65) = "453 362 372 272 262 362 923 000"
        VectorChar(66) = "623 532 422 122 032 042 152 452 542 652 543 532 923 000"
        VectorChar(67) = "072 043 252 552 642 632 522 122 032 923 000"
        VectorChar(68) = "553 152 042 032 122 522 632 923 000"
        VectorChar(69) = "623 672 643 452 152 042 032 122 522 632 923 000"
        VectorChar(70) = "623 122 032 042 262 462 642 042 923 000"
        VectorChar(71) = "223 262 372 472 562 143 342 923 000"
        VectorChar(72) = "103 402 512 542 652 543 452 152 042 032 122 422 532 923 000"
        VectorChar(73) = "072 043 252 552 642 622 923 000"
        VectorChar(74) = "373 472 353 322 422 923 000"
        VectorChar(75) = "373 472 453 402 202 923 000"
        VectorChar(76) = "072 043 442 552 443 622 923 000"
        VectorChar(77) = "273 222 422 923 000"
        VectorChar(78) = "052 152 332 552 652 622 923 000"
        VectorChar(79) = "052 043 252 552 642 622 923 000"
        VectorChar(80) = "123 032 042 152 552 642 632 522 122 923 000"
        VectorChar(81) = "002 023 052 043 252 552 642 632 522 222 032 923 000"
        VectorChar(82) = "653 642 452 152 042 032 122 522 632 643 602 702 923 000"
        VectorChar(83) = "052 043 252 552 642 923 000"
        VectorChar(84) = "522 632 542 242 152 362 562 923 000"
        VectorChar(85) = "423 322 372 263 562 923 000"
        VectorChar(86) = "053 032 122 422 522 552 533 622 923 000"
        VectorChar(87) = "053 222 552 652 923 000"
        VectorChar(88) = "052 023 122 342 522 622 652 923 000"
        VectorChar(89) = "122 342 552 652 053 152 342 522 622 923 000"
        VectorChar(90) = "053 032 122 422 632 652 633 602 402 923 000"
        VectorChar(91) = "652 052 023 622 923 000"
        VectorChar(92) = "483 372 362 252 342 332 422 923 000"
        VectorChar(93) = "323 342 363 382 923 000"
        VectorChar(94) = "223 332 342 452 362 372 282 923 000"
        VectorChar(95) = "073 182 282 462 562 672 923 000"
        VectorChar(96) = "123 152 052 382 652 552 522 122 923 000"
        For i = 1 To VF_CHARACTERS
            For j = 1 To VF_MOVES_PER_CHARACTER
                k = (4 * j) - 4 'k = (4 * j) - 3;
                tmpString = VectorChar(i).Substring(k + 2, 1)
                vf(i, j).pen = Integer.Parse(tmpString)
                If vf(i, j).pen = 0 Then Exit For
                tmpString = VectorChar(i).Substring(k, 1)
                vf(i, j).XI = Double.Parse(tmpString)
                vf(i, j).XI *= VF_ASPECT_RATIO
                tmpString = VectorChar(i).Substring(k + 1, 1)
                vf(i, j).YI = Double.Parse(tmpString)
            Next j
        Next i

    End Sub

    Public Sub FillTextVertices(ByVal inStr As String, ByVal CharHeight As Double, ByVal HAlignment As Integer, ByVal VAlignment As Integer, ByRef tX() As Double, ByRef tY() As Double)

        Dim i, j, NumChars, NumPts, pos As Integer
        Const CharWidth As Double = VF_ASPECT_RATIO * 9 ' 9 is initial height

        NumPts = 0
        NumChars = inStr.Length()

        For pos = 0 To NumChars - 1
            If Microsoft.VisualBasic.Asc(inStr.Substring(pos, 1)) = 13 Then
                'do nothing
            ElseIf Microsoft.VisualBasic.Asc(inStr.Substring(pos, 1)) = 10 Then
                'do nothing
            Else
                i = Microsoft.VisualBasic.Asc(inStr.Substring(pos, 1)) - 31
                For j = 1 To VF_MOVES_PER_CHARACTER
                    If vf(i, j).pen = 2 Then NumPts += 2
                Next j
            End If
        Next pos

        ReDim tX(NumPts)
        ReDim tY(NumPts)

        Dim LineStart As Integer = 0, LineEnd As Integer = 1
        Dim YOffset As Double = 0.0
        Dim CharStartX As Double = 0.0
        Dim XCurrent As Double = 0.0
        Dim YCurrent As Double = 0.0
        Dim XStart As Double, YStart As Double

        For pos = 0 To NumChars - 1
            If Microsoft.VisualBasic.Asc(inStr.Substring(pos, 1)) = 13 Then
                YOffset -= 9.0 + 2.0 '9.0 is initial char height, 2.0 is spacing
                CharStartX = 0.0
            ElseIf Microsoft.VisualBasic.Asc(inStr.Substring(pos, 1)) = 10 Then
                'do nothing
            Else
                i = Microsoft.VisualBasic.Asc(inStr.Substring(pos, 1)) - 31 ' ASCII 32 is VectorFont(1)   

                If vf(i, 1).pen = 2 Then
                    XStart = CharStartX
                    YStart = 2.0 + YOffset
                End If

                For j = 1 To VF_MOVES_PER_CHARACTER

                    If vf(i, j).pen = 0 Then Exit For

                    If vf(i, j).pen = 2 Then ' pen down finishes a line
                        XCurrent = vf(i, j).XI + CharStartX
                        YCurrent = vf(i, j).YI + YOffset

                        tX(LineStart) = XStart : tX(LineEnd) = XCurrent
                        tY(LineStart) = YStart : tY(LineEnd) = YCurrent

                        LineStart += 2 : LineEnd += 2

                        XStart = XCurrent
                        YStart = YCurrent
                    ElseIf vf(i, j).pen = 3 Then ' pen up starts a new line
                        XStart = vf(i, j).XI + CharStartX
                        YStart = vf(i, j).YI + YOffset
                    End If
                Next j
                CharStartX += CharWidth
            End If
        Next pos

        Dim ScaleFactor As Double = CharHeight / 9.0
        Dim OffsetX As Double = 0.0, OffsetY = 0.0

        Select Case HAlignment
            Case TextAlignment.kTA_HCenter
                OffsetX = -NumChars * CharWidth / 2.0
            Case TextAlignment.kTA_HRight
                OffsetX = -NumChars * CharWidth
        End Select

        Select Case VAlignment
            Case TextAlignment.kTA_VCenter
                OffsetY = -9 / 2.0
            Case TextAlignment.kTA_VTop
                OffsetY = 0.0
            Case TextAlignment.kTA_VBottom
                OffsetY = -9.0
        End Select

        For i = 0 To NumPts - 1
            tX(i) += OffsetX : tY(i) += OffsetY
            tX(i) *= ScaleFactor : tY(i) *= ScaleFactor
        Next i

    End Sub

End Class



VB NET Form1 Code:


Public Class Form1


    Protected ParentPluginObject As cPlugin

    Protected SapModel As cSapModel
    Protected ISapPlugin As cPluginCallback


        Public Sub setParentPluginObject(ByRef inParentPluginObject As cPlugin)


            ParentPluginObject = inParentPluginObject


        End Sub


        Public Sub setSapModel(ByRef inSapModel As cSapModel, ByRef inISapPlugin As cPluginCallback)


            SapModel = inSapModel

            ISapPlugin = inISapPlugin
        Me.TopMost = True
        Me.Show()

    End Sub


    Private Sub FramesFromTextForm_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing


        ' It is very important to call ISapPlugin.Finish(0) when form closes, !!!

        ' otherwise, the CSI program will wait and be hung !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        SapModel = Nothing

        ISapPlugin.Finish(0)

        End Sub


    Private Sub BtnMoveRigh_Click(sender As Object, e As EventArgs) Handles BtnMoveRight.Click


        Try


            If ListBox1.SelectedIndex = -1 Then

                MsgBox("Please select an item")
            Else

                '    ListBox2.Items.Add(ListBox1.SelectedItem)

                '    ListBox1.Items.Remove(ListBox1.SelectedItem)


                Dim SelectedItems = (From i In ListBox1.SelectedItems).ToList


                For Each selectedItem In SelectedItems


                    ListBox2.Items.Add(selectedItem)

                    ListBox1.Items.Remove(selectedItem)

                Next


            End If



            'Uncheck Checkbox                     

            CheckBox1.Checked = False
            CheckBox2.Checked = False

            'sort

            Call NoEmptyNoDuplicateSort2()


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnMoveRight2_Click(sender As Object, e As EventArgs) Handles BtnMoveRight2.Click


        Try

            If ListBox3.SelectedIndex = -1 Then
                MsgBox("Please select an item")
            Else

                '    ListBox2.Items.Add(ListBox1.SelectedItem)

                '    ListBox1.Items.Remove(ListBox1.SelectedItem)


                Dim SelectedItems = (From i In ListBox3.SelectedItems).ToList


                For Each selectedItem In SelectedItems


                    ListBox4.Items.Add(selectedItem)

                    ListBox3.Items.Remove(selectedItem)

                Next


            End If



            'Uncheck Checkbox  

            CheckBox3.Checked = False
            CheckBox4.Checked = False

            'sort

            Call NoEmptyNoDuplicateSort4()



        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try


    End Sub


    Private Sub BtnMoveLeft_Click(sender As Object, e As EventArgs) Handles BtnMoveLeft.Click


        Try


            If ListBox2.SelectedIndex = -1 Then

                MsgBox("Please select an item")
            Else
                'ListBox1.Items.Add(ListBox2.SelectedItem)
                'ListBox2.Items.Remove(ListBox2.SelectedItem)

                Dim SelectedItems = (From i In ListBox2.SelectedItems).ToList


                For Each selectedItem In SelectedItems


                    ListBox1.Items.Add(selectedItem)

                    ListBox2.Items.Remove(selectedItem)

                Next


            End If



            'Uncheck Checkbox                     

            CheckBox1.Checked = False
            CheckBox2.Checked = False

            'sort

            Call NoEmptyNoDuplicateSort1()


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnMoveLeft2_Click(sender As Object, e As EventArgs) Handles BtnMoveLeft2.Click


        Try


            If ListBox4.SelectedIndex = -1 Then

                MsgBox("Please select an item")
            Else
                'ListBox1.Items.Add(ListBox2.SelectedItem)
                'ListBox2.Items.Remove(ListBox2.SelectedItem)

                Dim SelectedItems = (From i In ListBox4.SelectedItems).ToList


                For Each selectedItem In SelectedItems


                    ListBox3.Items.Add(selectedItem)

                    ListBox4.Items.Remove(selectedItem)

                Next


            End If


            'Uncheck Checkbox                     

            CheckBox1.Checked = False
            CheckBox2.Checked = False

            'sort

            Call NoEmptyNoDuplicateSort3()

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub BtnUnselect_Click(sender As Object, e As EventArgs) Handles BtnUnselect.Click


        Try

            Dim CallResult As Integer
            CallResult = SapModel.SelectObj.ClearSelection()

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)

        End Try

    End Sub

    Private Sub BtnUnselect2_Click(sender As Object, e As EventArgs) Handles BtnUnselect2.Click


        Try

            Dim CallResult As Integer
            CallResult = SapModel.SelectObj.ClearSelection()

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)

        End Try

    End Sub

    Private Sub BtnClose_Click(sender As Object, e As EventArgs) Handles BtnClose.Click


        SapModel = Nothing

        Me.Close()
    End Sub

    Private Sub BtnClose2_Click(sender As Object, e As EventArgs) Handles BtnClose2.Click


        SapModel = Nothing

        Me.Close()


    End Sub


    Private Sub CheckBox1_Click(sender As Object, e As EventArgs) Handles CheckBox1.Click


        Try

            If ListBox1.Items.Count = 0 Then
                MsgBox("No item")
                CheckBox1.Checked = False

            Else

                If CheckBox1.Checked = True Then

                    For i = 0 To Me.ListBox1.Items.Count - 1

                        Me.ListBox1.SetSelected(i, True)
                    Next
                Else
                    ListBox1.ClearSelected()
                End If
            End If

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub CheckBox2_Click(sender As Object, e As EventArgs) Handles CheckBox2.Click


        Try


            If ListBox2.Items.Count = 0 Then

                MsgBox("No item")
                CheckBox2.Checked = False
            Else

                If CheckBox2.Checked = True Then


                    For i = 0 To Me.ListBox2.Items.Count - 1

                        Me.ListBox2.SetSelected(i, True)
                    Next
                Else
                    ListBox2.ClearSelected()
                End If
            End If

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub CheckBox3_Click(sender As Object, e As EventArgs) Handles CheckBox3.Click


        Try


            If ListBox3.Items.Count = 0 Then

                MsgBox("No item")
                CheckBox3.Checked = False

            Else

                If CheckBox3.Checked = True Then

                    For i = 0 To Me.ListBox3.Items.Count - 1

                        Me.ListBox3.SetSelected(i, True)
                    Next
                Else
                    ListBox3.ClearSelected()
                End If
            End If

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub CheckBox4_Click(sender As Object, e As EventArgs) Handles CheckBox4.Click


        Try


            If ListBox4.Items.Count = 0 Then

                MsgBox("No item")
                CheckBox4.Checked = False
            Else

                If CheckBox4.Checked = True Then


                    For i = 0 To Me.ListBox4.Items.Count - 1

                        Me.ListBox4.SetSelected(i, True)
                    Next
                Else
                    ListBox4.ClearSelected()
                End If
            End If

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnSelect_Click(sender As Object, e As EventArgs) Handles BtnSelect.Click


        Try


            Dim CallResult As Integer


            CallResult = SapModel.SelectObj.ClearSelection()


            If ListBox2.Items.Count = 0 Then

                MsgBox("No item")


            Else

                'ListBox1.Items.Add(ListBox2.SelectedItem)
                'ListBox2.Items.Remove(ListBox2.SelectedItem)

                CheckBox2.Checked = True

                CheckBox2_Click(sender, e)

                Dim SelectedItems = (From i In ListBox2.SelectedItems).ToList


                For Each selectedItem In SelectedItems


                    CallResult = SapModel.FrameObj.SetSelected(selectedItem, True)


                Next


            End If


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnSelect2_Click(sender As Object, e As EventArgs) Handles BtnSelect2.Click


        Try


            Dim CallResult As Integer



            If ListBox4.Items.Count = 0 Then

                MsgBox("No item")


            Else

                'ListBox1.Items.Add(ListBox2.SelectedItem)
                'ListBox2.Items.Remove(ListBox2.SelectedItem)


                CheckBox4.Checked = True

                CheckBox4_Click(sender, e)


                Dim SelectedItems = (From i In ListBox4.SelectedItems).ToList


                For Each selectedItem In SelectedItems


                    CallResult = SapModel.PointObj.SetSelected(selectedItem, True)


                Next


            End If


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnImport_Click(sender As Object, e As EventArgs) Handles BtnImport.Click


        Try


            Dim i As Integer


            'select item to in list box


            For i = 0 To Me.ListBox1.Items.Count - 1

                Me.ListBox1.SetSelected(i, True)
            Next

            For i = 0 To Me.ListBox2.Items.Count - 1

                Me.ListBox2.SetSelected(i, True)
            Next

            'delete selected item to in list box


            Dim SelectedItems1 = (From j In ListBox1.SelectedItems).ToList

            For Each selectedItem In SelectedItems1
                ListBox1.Items.Remove(selectedItem)
            Next

            Dim SelectedItems2 = (From k In ListBox2.SelectedItems).ToList

            For Each selectedItem In SelectedItems2
                ListBox2.Items.Remove(selectedItem)
            Next

            'remove check in the check box


            CheckBox1.Checked = False

            CheckBox2.Checked = False


            'import from ETABS


            Dim CallResult As Integer

            Dim NumberFrame As Integer
            Dim FrameName() As String




            CallResult = SapModel.FrameObj.GetNameList(NumberFrame, FrameName)




            For i = LBound(FrameName) To UBound(FrameName)


                Me.ListBox1.Items.Add(FrameName(i))


            Next i



        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try


    End Sub


    Private Sub BtnImport2_Click(sender As Object, e As EventArgs) Handles BtnImport2.Click


        Try


            Dim i As Integer


            'select item to in list box


            For i = 0 To Me.ListBox3.Items.Count - 1

                Me.ListBox3.SetSelected(i, True)
            Next

            For i = 0 To Me.ListBox4.Items.Count - 1

                Me.ListBox4.SetSelected(i, True)
            Next

            'delete selected item to in list box


            Dim SelectedItems3 = (From j In ListBox3.SelectedItems).ToList

            For Each selectedItem In SelectedItems3
                ListBox3.Items.Remove(selectedItem)
            Next


            Dim SelectedItems4 = (From k In ListBox4.SelectedItems).ToList

            For Each selectedItem In SelectedItems4
                ListBox4.Items.Remove(selectedItem)
            Next

            'remove check in the check box


            CheckBox3.Checked = False

            CheckBox4.Checked = False


            'import from ETABS


            Dim CallResult As Integer

            Dim NumberPoint As Integer
            Dim PointName() As String



            CallResult = SapModel.PointObj.GetNameList(NumberPoint, PointName)



            For i = LBound(PointName) To UBound(PointName)


                Me.ListBox3.Items.Add(PointName(i))


            Next i


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try


    End Sub


    Private Sub ListBox2_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox2.MouseDoubleClick


        Try


            Dim objInputBox As Object = InputBox("Change Item :", "Edit", ListBox2.SelectedItem)

            If Not objInputBox = Nothing Then
                If IsNumeric(objInputBox) Then
                    If Not ListBox2.SelectedIndex = -1 Then
                        ListBox2.Items(ListBox2.SelectedIndex) = objInputBox
                    Else
                        ListBox2.Items.Add(objInputBox)
                    End If
                End If
            End If

            'Sort Yes or No

            Dim ans As String
            ans = MsgBox("Sort Value?", vbYesNo)
            If ans = vbYes Then
                Call NoEmptyNoDuplicateSort2()
            End If


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub ListBox4_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox4.MouseDoubleClick


        Try


            Dim objInputBox As Object = InputBox("Change Item :", "Edit", ListBox4.SelectedItem)

            If Not objInputBox = Nothing Then
                If IsNumeric(objInputBox) Then
                    If Not ListBox4.SelectedIndex = -1 Then
                        ListBox4.Items(ListBox4.SelectedIndex) = objInputBox
                    Else
                        ListBox4.Items.Add(objInputBox)
                    End If
                End If
            End If


            'Sort Yes or No

            Dim ans As String
            ans = MsgBox("Sort Value?", vbYesNo)
            If ans = vbYes Then
                Call NoEmptyNoDuplicateSort4()
            End If


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnPlus_Click(sender As Object, e As EventArgs) Handles BtnPlus.Click


        Try


            Dim objInputBox As Object = InputBox("Change Item :", "Edit", ListBox2.SelectedItem)

            If Not objInputBox = Nothing Then
                If IsNumeric(objInputBox) Then
                    ListBox2.Items.Add(objInputBox)
                End If
            End If

            'Sort

            Call NoEmptyNoDuplicateSort2()



        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub TbnAddVal2_Click(sender As Object, e As EventArgs) Handles TbnPlus2.Click


        Try


            Dim objInputBox As Object = InputBox("Change Item :", "Edit", ListBox4.SelectedItem)

            If Not objInputBox = Nothing Then
                If IsNumeric(objInputBox) Then
                    ListBox4.Items.Add(objInputBox)
                End If
            End If

            'sort

            Call NoEmptyNoDuplicateSort4()

        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try



    End Sub


    Private Sub BtnMinus_Click(sender As Object, e As EventArgs) Handles BtnMinus.Click


        Try


            If Not ListBox2.SelectedIndex = -1 Then

                ListBox2.Items.Remove(ListBox2.SelectedItem)
            End If



        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnMinus2_Click(sender As Object, e As EventArgs) Handles BtnMinus2.Click


        Try


            If Not ListBox4.SelectedIndex = -1 Then

                ListBox4.Items.Remove(ListBox4.SelectedItem)
            End If


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub



    Private Sub BtnClr_Click(sender As Object, e As EventArgs) Handles BtnClr.Click


        Try


            'Select and deleted item

            If Not ListBox1.Items.Count = 0 Then

                For i = 0 To Me.ListBox1.Items.Count - 1

                    Me.ListBox1.SetSelected(i, True)
                Next

                Dim SelectedItems = (From i In ListBox1.SelectedItems).ToList

                For Each selectedItem In SelectedItems
                    ListBox1.Items.Remove(selectedItem)
                Next

            End If




            If Not ListBox2.Items.Count = 0 Then


                For i = 0 To Me.ListBox2.Items.Count - 1

                    Me.ListBox2.SetSelected(i, True)
                Next

                Dim SelectedItems = (From i In ListBox2.SelectedItems).ToList

                For Each selectedItem In SelectedItems
                    ListBox2.Items.Remove(selectedItem)
                Next

            End If



            'Uncheck Checkbox

            CheckBox1.Checked = False
            CheckBox2.Checked = False


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BntClr2_Click(sender As Object, e As EventArgs) Handles BntClr2.Click


        Try


            'Select and deleted item

            If Not ListBox3.Items.Count = 0 Then

                For i = 0 To Me.ListBox3.Items.Count - 1

                    Me.ListBox3.SetSelected(i, True)
                Next

                Dim SelectedItems = (From i In ListBox3.SelectedItems).ToList

                For Each selectedItem In SelectedItems
                    ListBox3.Items.Remove(selectedItem)
                Next

            End If



            If Not ListBox4.Items.Count = 0 Then


                For i = 0 To Me.ListBox4.Items.Count - 1

                    Me.ListBox4.SetSelected(i, True)
                Next

                Dim SelectedItems = (From i In ListBox4.SelectedItems).ToList

                For Each selectedItem In SelectedItems
                    ListBox4.Items.Remove(selectedItem)
                Next

            End If



            'Uncheck Checkbox

            CheckBox3.Checked = False
            CheckBox4.Checked = False


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub BtnAddList_Click(sender As Object, e As EventArgs) Handles BtnAddList.Click


        Try



            Using f2 As New Form2


                Me.TopMost = False

                f2.TopMost = True

                If f2.ShowDialog() = Windows.Forms.DialogResult.OK Then


                    'Clear all content

                    BtnClr_Click(sender, e)

                    'TextBox to ListBox

                    ListBox2.Items.AddRange(Split(f2.TextBoxText, vbCrLf))
                    NoEmptyNoDuplicateSort2()

                End If


                f2.TopMost = False

                Me.TopMost = True

            End Using



        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try


    End Sub


    Private Sub BtnAddList2_Click(sender As Object, e As EventArgs) Handles BtnAddList2.Click


        Try



            Using f3 As New Form2


                Me.TopMost = False

                f3.TopMost = True

                If f3.ShowDialog() = Windows.Forms.DialogResult.OK Then


                    'Clear all content

                    BntClr2_Click(sender, e)

                    'TextBox to ListBox

                    ListBox4.Items.AddRange(Split(f3.TextBoxText, vbCrLf))
                    Call NoEmptyNoDuplicateSort4()
                End If

                f3.TopMost = False

                Me.TopMost = True
            End Using




        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Sub NoEmptyNoDuplicateSort1()


        Try


            'Remove empty items in ListBox

            For i = ListBox1.Items.Count - 1 To 0 Step -1
                If String.IsNullOrEmpty(CStr(ListBox1.Items(i))) Then
                    ListBox1.Items.RemoveAt(i)
                End If
            Next

            'Arrange Numerically

            Dim arr(ListBox1.Items.Count - 1) As Integer
            For i As Integer = 0 To ListBox1.Items.Count - 1
                arr(i) = ListBox1.Items(i)
            Next
            Array.Sort(arr)
            ListBox1.Sorted = False
            ListBox1.Items.Clear()
            ListBox1.Items.AddRange(arr.Cast(Of Object).ToArray())

            'Remove Duplicate

            For Row As Int16 = 0 To ListBox1.Items.Count - 2
                For RowAgain As Int16 = ListBox1.Items.Count - 1 To Row + 1 Step -1
                    If ListBox1.Items(Row).ToString = ListBox1.Items(RowAgain).ToString Then
                        ListBox1.Items.RemoveAt(RowAgain)
                    End If
                Next
            Next


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Sub NoEmptyNoDuplicateSort2()


        Try


            'Remove empty items in ListBox

            For i = ListBox2.Items.Count - 1 To 0 Step -1
                If String.IsNullOrEmpty(CStr(ListBox2.Items(i))) Then
                    ListBox2.Items.RemoveAt(i)
                End If
            Next

            'Arrange Numerically

            Dim arr(ListBox2.Items.Count - 1) As Integer
            For i As Integer = 0 To ListBox2.Items.Count - 1
                arr(i) = ListBox2.Items(i)
            Next
            Array.Sort(arr)
            ListBox2.Sorted = False
            ListBox2.Items.Clear()
            ListBox2.Items.AddRange(arr.Cast(Of Object).ToArray())

            'Remove Duplicate

            For Row As Int16 = 0 To ListBox2.Items.Count - 2
                For RowAgain As Int16 = ListBox2.Items.Count - 1 To Row + 1 Step -1
                    If ListBox2.Items(Row).ToString = ListBox2.Items(RowAgain).ToString Then
                        ListBox2.Items.RemoveAt(RowAgain)
                    End If
                Next
            Next


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Sub NoEmptyNoDuplicateSort3()


        Try


            'Remove empty items in ListBox

            For i = ListBox3.Items.Count - 1 To 0 Step -1
                If String.IsNullOrEmpty(CStr(ListBox3.Items(i))) Then
                    ListBox3.Items.RemoveAt(i)
                End If
            Next

            'Arrange Numerically

            Dim arr(ListBox3.Items.Count - 1) As Integer
            For i As Integer = 0 To ListBox3.Items.Count - 1
                arr(i) = ListBox3.Items(i)
            Next
            Array.Sort(arr)
            ListBox3.Sorted = False
            ListBox3.Items.Clear()
            ListBox3.Items.AddRange(arr.Cast(Of Object).ToArray())

            'Remove Duplicate

            For Row As Int16 = 0 To ListBox3.Items.Count - 2
                For RowAgain As Int16 = ListBox3.Items.Count - 1 To Row + 1 Step -1
                    If ListBox3.Items(Row).ToString = ListBox3.Items(RowAgain).ToString Then
                        ListBox3.Items.RemoveAt(RowAgain)
                    End If
                Next
            Next


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Sub NoEmptyNoDuplicateSort4()


        Try



            'Remove empty items in ListBox

            For i = ListBox4.Items.Count - 1 To 0 Step -1
                If String.IsNullOrEmpty(CStr(ListBox4.Items(i))) Then
                    ListBox4.Items.RemoveAt(i)
                End If
            Next

            'Arrange Numerically

            Dim arr(ListBox4.Items.Count - 1) As Integer
            For i As Integer = 0 To ListBox4.Items.Count - 1
                arr(i) = ListBox4.Items(i)
            Next
            Array.Sort(arr)
            ListBox4.Sorted = False
            ListBox4.Items.Clear()
            ListBox4.Items.AddRange(arr.Cast(Of Object).ToArray())

            'Remove Duplicate

            For Row As Int16 = 0 To ListBox4.Items.Count - 2
                For RowAgain As Int16 = ListBox4.Items.Count - 1 To Row + 1 Step -1
                    If ListBox4.Items(Row).ToString = ListBox4.Items(RowAgain).ToString Then
                        ListBox4.Items.RemoveAt(RowAgain)
                    End If
                Next
            Next


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub PictureBox1_MouseHover(sender As Object, e As EventArgs) Handles PictureBox1.MouseHover


        Try


            PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub PictureBox1_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox1.MouseLeave

        Try

            PictureBox1.SizeMode = PictureBoxSizeMode.Normal


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked


        Try


            Process.Start(String.Format("mailto:{0}", "ernel_filipinas@yahoo.com"))


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub


    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click


        Try


            MsgBox("Thank you for using our ETABs Plugin,  you may contact us for comments/further information.")


        Catch ex As Exception

            ' Show the exception's message.
            MessageBox.Show(ex.Message)
        End Try

    End Sub



End Class


VB NET Form2 Code:


Public Class Form2

    Public Property TextBoxText() As String
        Get
            Return Me.TextBox1.Text
        End Get

        Set(ByVal value As String)
            Me.TextBox1.Text = value
        End Set
    End Property


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOk.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK

    End Sub




    Private Sub TextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

        'Numerical only
        If Not Char.IsNumber(e.KeyChar) AndAlso Not Char.IsControl(e.KeyChar) Then
            e.Handled = True
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles BtnCancel.Click
        Me.Close()
    End Sub
End Class


Disclaimer:
No Liability is accepted by its software authors for any direct, indirect, consequential or incidental loss or damage arising out of the software use or any mistakes and negligence in developing this software. The organisation or person using the software bears all risks and responsibility for the quality and performance of the software.

link


No comments: