Torna al Thread
Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
If (e.Node.Parent Is Nothing) Then
e.Node.SelectedImageIndex = 0
Else
Dim codAllog As Integer
Dim text As String = CStr(e.Node.Tag)
CaricaNumComponenti(Now.Year, CInt(e.Node.FullPath.Substring(17, 9)), CInt([text].Substring(4, 2)))
If DtAlloggiatoMyRow.Ncomponenti > DtAlloggiatoMyRow.CompInseriti Then
If MessageBox.Show("Attenzione ci sono ancora numero: " & (DtAlloggiatoMyRow.Ncomponenti - DtAlloggiatoMyRow.CompInseriti) & " componenti da inserire per terminare la registrazione della schedina nr. " & _
String.Format("{0:D9}", CInt(e.Node.FullPath.Substring(17, 9))) & Chr(10) & " procedere con l'inserimento?", "Send.Net", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
If CInt([text].Substring(4, 2)) = 17 Then
Me.Label27.Text = String.Format("{0:D9}", CInt(e.Node.FullPath.Substring(17, 9)))
Me.ComboBox1.Items.Clear()
Me.ComboBox1.Text = "COMPONENTE FAMILIARE"
Me.VariabileAllog = 19
Dim VarCognome As String() = e.Node.Text.Split(CChar(" "))
Me.TextBox3.Text = VarCognome(0)
REM Recupero e valorizzo la variabile per ottenere il conto esatto dei componenti inseriti
REM InsertNComp = DtAlloggiatoMyRow.CompInseriti
REM recupero l'id componente per aggionare il campo specifico
Me.Label9.Text = CStr(CInt(Me.Label9.Text) + DtAlloggiatoMyRow.CompInseriti)
Me.VarComponenti = True
Me.bloccacampi()
Me.TextBox3.Focus()
Me.TextBox3.SelectAll()
ElseIf CInt([text].Substring(4, 2)) = 18 Then
Me.Label27.Text = String.Format("{0:D9}", CInt(e.Node.FullPath.Substring(17, 9)))
Me.ComboBox1.Items.Clear()
Me.ComboBox1.Text = "MEMBRO GRUPPO"
Me.VariabileAllog = 20
REM recupero l'id componente per aggionare il campo specifico
Me.Label9.Text = CStr(CInt(Me.Label9.Text) + DtAlloggiatoMyRow.CompInseriti)
Me.VarComponenti = True
Me.bloccacampi()
Me.TextBox3.Focus()
End If
Else
Me.CaricaCliente(DateAndTime.Now.Year, CInt(e.Node.FullPath.Substring(17, 9)), CInt([text].Substring(0, 3)))
Select Case Me.VariabileAllog
Case 17, 19
codAllog = 17
Exit Select
Case 18, 20
codAllog = 18
Exit Select
End Select
Me.CaricaNumComponenti(DateAndTime.Now.Year, CInt(e.Node.FullPath.Substring(17, 9)), codAllog)
End If
Else
Me.CaricaCliente(DateAndTime.Now.Year, CInt(e.Node.FullPath.Substring(17, 9)), CInt([text].Substring(0, 3)))
Select Case Me.VariabileAllog
Case 17, 19
codAllog = 17
Exit Select
Case 18, 20
codAllog = 18
Exit Select
End Select
Me.CaricaNumComponenti(DateAndTime.Now.Year, CInt(e.Node.FullPath.Substring(17, 9)), codAllog)
End If
End If
Me.TextBox3.Focus()
End Sub