ETABS plug-in sample: https://wiki.csiamerica.com/display/kb/Sample+Plugin+1
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
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 VectorFont 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 BtnMoveRight_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 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 BtnClose_Click(sender As Object, e As EventArgs)
'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 BtnAddCombo_Click(sender As Object, e As EventArgs) Handles BtnAddCombo.Click
Try
Me.TopMost = False
' add combo
Dim CallResult As Integer
Dim ComboName As String
Dim CombTypName As String
Dim CombTyp As Integer
ComboName = TextBox1.Text
CombTypName = ComboBox1.Text
If ComboName = "" Then
MsgBox("Please Enter Envelope Name")
Else
Select Case CombTypName
Case "Linear Additive"
CombTyp = 0
Case "Envelope"
CombTyp = 1
Case "Absolute Additive"
CombTyp = 2
Case "SRSS"
CombTyp = 3
Case "Range Additive"
CombTyp = 4
Case Nothing
MsgBox("Please select Envelope Combo Type")
CombTyp = 5
Case Else
MsgBox("Please select correct Envelope Combo Type")
CombTyp = 6
End Select
If CombTyp >= 0 And CombTyp <= 4 Then
If Not ListBox2.Items.Count = 0 Then
'Add ComboName and Type
If ListBox1.Items.Contains(ComboName) Or ListBox2.Items.Contains(ComboName) Then
'Overwrite Yes or No
Dim ans As String
ans = MsgBox(ComboName & " already exist" & vbCrLf & vbCrLf & "Do you want to overwrite ?", vbYesNo)
If ans = vbYes Then
'overwrite ComboName in ETABS
CallResult = SapModel.RespCombo.Delete(ComboName)
CallResult = SapModel.RespCombo.Add(ComboName, CombTyp)
End If
Else
'Add in Combo Name in ETABS
CallResult = SapModel.RespCombo.Add(ComboName, CombTyp)
End If
'Remove ComboName in the ListBox2
If ListBox2.Items.Contains(ComboName) Then
ListBox2.Items.Remove(ComboName)
ListBox1.Items.Add(ComboName)
End If
CheckBox2.Checked = True
CheckBox2_Click(sender, e)
'Add Case in ComboName
Dim SelectedItems = (From i In ListBox2.SelectedItems).ToList
For Each selectedItem In SelectedItems
CallResult = SapModel.RespCombo.SetCaseList(ComboName, 1, selectedItem, 1)
Next
Else
MsgBox("No item selected")
End If
End If
End If
Me.TopMost = True
Me.Show()
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 NumberNames As Integer
Dim MyName() As String
'get combo names
CallResult = SapModel.RespCombo.GetNameList(NumberNames, MyName)
For i = 0 To NumberNames - 1
Me.ListBox1.Items.Add(MyName(i))
Next i
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 BtnAddList_Click(sender As Object, e As EventArgs)
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
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
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
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.