Imports System.Windows.Forms Imports TestEIn.EgtInterface Public Class SelectMulti Dim m_nCurrEnt As Integer Private Sub SelectMulti_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load ListBox1.BeginUpdate() 'Inserisco le entità nel mirino Dim nId = EgtGetFirstObjInSelWin() While nId <> GDB_ID.NULL Dim sTitle As String = String.Empty EgtGetTitle(nId, sTitle) If EgtIsSelectedObj(nId) Then sTitle += "*" End If sTitle += " (" & nId & ")" Dim smItem As New SelMulItem(sTitle, nId) ListBox1.Items.Add(smItem) nId = EgtGetNextObjInSelWin() End While 'Inserisco None per non selezionare alcunchè Dim smNone As New SelMulItem("None", GDB_ID.NULL) ListBox1.Items.Add(smNone) ListBox1.EndUpdate() m_nCurrEnt = GDB_ID.NULL ListBox1.SelectedIndex = 0 End Sub Private Sub SelectMulti_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed EgtResetMark(m_nCurrEnt) EgtDraw() End Sub Public Function GetId() As Integer Return m_nCurrEnt End Function Private Sub OK_Click(sender As System.Object, e As System.EventArgs) Handles OK_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End Sub Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End Sub Private Sub ListBox1_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles Me.KeyDown If e.KeyData = Keys.Escape Then Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End If End Sub Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged EgtResetMark(m_nCurrEnt) m_nCurrEnt = ListBox1.SelectedItem.m_nId EgtSetMark(m_nCurrEnt) EgtDraw() End Sub Private Class SelMulItem Public m_sTitle As String Public m_nId As Integer Public Sub New(ByVal sTitle As String, ByVal nId As Integer) Me.m_sTitle = sTitle Me.m_nId = nId End Sub Public Overrides Function ToString() As String Return m_sTitle End Function End Class End Class