L
LuigiB
Guest
ma come t ipiace di piu cosi ssembra carino poi vediamo il layout lo possiamo cambiare dopo in funzione delle necessita che ti credi micaabbiamo finito con sta finestra
Codice:Private Sub ButtonSelezionaTutto_Click(sender As Object, e As EventArgs) Handles ButtonSelezionaTutto.Click For k As Integer = 0 To LvLunghette.Items.Count - 1 LvLunghette.Items(k).Selected = True LvLunghette.Select() <------- ? Next End Sub
mai sentito parlare dell'operatore not ?Per quanto riguarda inverti selezione ci sto pensando
Private Sub ButtonSelezionaTutto_Click(sender As Object, e As EventArgs) Handles ButtonSelezionaTutto.Click
For k As Integer = 0 To LvLunghette.Items.Count - 1
LvLunghette.Items(k).Selected = True
Next
LvLunghette.Select()
End Sub
Private Sub ButtonInvertiSel_Click(sender As Object, e As EventArgs) Handles ButtonInvertiSel.Click
For k As Integer = 0 To LvLunghette.Items.Count - 1
If LvLunghette.Items(k).Selected = False Then
LvLunghette.Items(k).Selected = True
LvLunghette.Select()
Else
LvLunghette.Items(k).Selected = False
End If
Next
End Sub
Private Sub ButtonSalva_Click(sender As Object, e As EventArgs) Handles ButtonSalva.Click
Dim NameFile As String
CreaFolderFileDefault(GetDirFormazioni)
If LvLunghette.Items.Count > 0 Then
If MessageBox.Show("Desideri salvare le formazioni?", "Salvataggio", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = DialogResult.Yes Then
NameFile = InputBox("Indicare nome del file", "Formazioni")
SalvaFormazioni(LvLunghette, GetDirFormazioni() & NameFile & ".csv")
End If
Else
MessageBox.Show("Nessuna formazione da salvare presente", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Function SalvaFormazioni(LvOrd As ctlLvOrdinabile, DirFile As String)
Dim SB As New StringBuilder
Dim i As Integer
Dim strmW As New StreamWriter(DirFile)
For Each itm In LvOrd.Items
i = 0
SB.Append("")
For Each ch As ColumnHeader In LvOrd.Columns
i += 1
SB.Append(itm.subitems(i - 1).text)
SB.Append(";")
Next
strmW.WriteLine(SB.Remove(SB.Length - 1, 1))
Next
strmW.Close()
End Function
Private Sub ButtonSalva_Click(sender As Object, e As EventArgs) Handles ButtonSalva.Click
Dim NameFile As String
CreaFolderFileDefault(GetDirFormazioni)
If LvLunghette.Items.Count > 0 Then
If MessageBox.Show("Desideri salvare le formazioni?", "Salvataggio", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = DialogResult.Yes Then
NameFile = InputBox("Indicare nome del file", "Formazioni")
SalvaFormazioni(LvLunghette, GetDirFormazioni() & NameFile & ".csv")
End If
Else
MessageBox.Show("Nessuna formazione da salvare presente", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Function SalvaFormazioni(LvOrd As ctlLvOrdinabile, DirFile As String)
Dim SB As New StringBuilder
Dim i As Integer
Dim strmW As New StreamWriter(DirFile)
For Each itm In LvOrd.Items
i = 0
SB.Remove(0, SB.ToString.Length)
For Each ch As ColumnHeader In LvOrd.Columns
i += 1
SB.Append(itm.subitems(i - 1).text)
SB.Append(";")
Next
strmW.WriteLine(SB.Remove(SB.Length - 1, 1))
Next
strmW.Close()
End Function