Follow along with the video below to see how to install our site as a web app on your home screen.
Nota: This feature may not be available in some browsers.
Buona notteBuona notte a tutti.
Per me si è fatta ora di nanna.
Public Class cltSelRuote
Private Check() As CheckBox
Private nCheck As Integer = 12
Private RetRuote() As Integer
Private mRetNumeri As Integer
Private mRetNumeriBool As Integer
Private RetRuoteBool() As Integer
Public Property nRetNumeri() As Integer
Get
Return mRetNumeri
End Get
Set(value As Integer)
End Set
End Property
Public Property ArrayRuote(ByVal Index As Integer) As Integer
Get
Return RetRuote(Index)
End Get
Set(ByVal value As Integer)
End Set
End Property
Public Property nRetNumeriBool() As Integer
Get
Return mRetNumeriBool
End Get
Set(value As Integer)
End Set
End Property
Public Property ArrayRuoteBool(ByVal Index As Integer) As Boolean
Get
Return RetRuoteBool(Index)
End Get
Set(ByVal value As Boolean)
End Set
End Property
Private Sub cltSelRuote_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LoadCampi()
End Sub
Sub LoadCampi()
Dim i As Integer
Dim nX As Integer, nY As Integer
Dim nHTxt As Integer = 15, nWTxt As Integer = 25
Dim Altezza As Integer = 21, Larghezza As Integer = 35
Dim nLeft As Integer = 10
ReDim Check(nCheck)
nX = 0
nY = 0
For r As Integer = 1 To nCheck
i += 1
Check(i) = New CheckBox
With Check(i)
.AutoSize = False
.Checked = False
.Left = nX
.Top = nY
.Width = Larghezza
.Height = Altezza
.TextAlign = ContentAlignment.MiddleCenter
.Appearance = Appearance.Button
.Text = NomiRuote(i).NomeAbbreviato
Me.Controls.Add(Check(i))
AddHandler Check(i).CheckStateChanged, AddressOf Gestione_CheckstateChanged
.Visible = True
End With
nX = nX + Larghezza
Next
End Sub
Private Sub Gestione_CheckstateChanged(sender As Object, e As EventArgs)
mRetNumeri = GetRuoteSelezionate(RetRuote)
mRetNumeriBool = GetRuoteSelezionate(RetRuoteBool)
End Sub
Function GetRuoteSelezionate(ByRef aRetRuote() As Integer) As Integer
Dim n As Integer
Dim m As Integer
For i As Integer = 1 To nCheck
n += 1
If Check(i).Checked = True Then
m += 1
ReDim Preserve aRetRuote(i)
aRetRuote(m) = n
End If
Next
Return m
End Function
Function GetRuoteSelezionate(ByRef aRetRuote() As Boolean) As Integer
Dim n As Integer
Dim m As Integer
ReDim aRetRuote(nCheck)
For x As Integer = 1 To nCheck
aRetRuote(x) = False
Next
For i As Integer = 1 To nCheck
If Check(i).Checked = True Then
m += 1
ReDim Preserve aRetRuote(i)
aRetRuote(i) = True
End If
Next
Return m
End Function
End Class
Function GetRuoteSelezionate(ByRef aRetRuote() As Boolean) As Integer
Dim n As Integer
Dim m As Integer
ReDim aRetRuote(nCheck)
For x As Integer = 1 To nCheck
aRetRuote(x) = False
Next
For i As Integer = 1 To nCheck
If Check(i).Checked = True Then
m += 1
ReDim Preserve aRetRuote(i)
aRetRuote(i) = True
End If
Next
Return m
End Function
Function GetRuoteSelezionate(ByRef aRetRuote() As Integer) As Integer
Dim i As Integer
For x As Integer = 1 To nCheck
If Check(x).Checked = True Then
i += 1
ReDim Preserve aRetRuote(x)
aRetRuote(x) = x
End If
Next
Return i
End Function
Function GetRuoteSelezionate(ByRef aRetRuote() As Boolean) As Integer
Dim i As Integer
For x As Integer = 1 To nCheck
If Check(x).Checked = True Then
i += 1
ReDim Preserve aRetRuote(x)
aRetRuote(x) = True
End If
Next
Return i
End Function
Sub SetRuoteSelezionate(aRuote() As Integer)
For x As Integer = 1 To aRuote.Length
NomiRuote(x).Nome = aRuote(x)
Next
End Sub
Sub SetRuoteSelezionate(aRuote() As Boolean)
For x As Integer = 1 To aRuote.Length
NomiRuote(x).Nome = aRuote(x)
Next
End Sub
Function GetRuoteSelezionate(ByRef aRetRuote() As Integer) As Integer
Dim i As Integer
ReDim aRetRuote (12) ' dimensiono al massimo possibile
For x As Integer = 1 To nCheck
If Check(x).Checked = True Then
i += 1
'aRetRuote(x) = x 'errato
aRetRuote(i) = x ' giusto
End If
Next
ReDim Preserve aRetRuote(i) ' ridimensiono al numero di ruote trovate
Return i
End Function
Function GetRuoteSelezionate(ByRef aRetRuote() As Boolean) As Integer
Dim i As Integer
ReDim aRetRuote (12) ' dimensiono al massimo possibile
For x As Integer = 1 To nCheck
If Check(x).Checked = True Then
i += 1
aRetRuote(x) = True
End If
Next
Return i
End Function
Sub SetRuoteSelezionate(aRuote() As Integer)
For x As Integer = 1 To aRuote.Length
Check (aRuote(x)).checked = true
Next
End Sub
Sub SetRuoteSelezionate(aRuote() As boolean)
For x As Integer = 1 To aRuote.Length
Check (x) .checked = aRuote(x)
Next
End Sub
function ArrayBToStringa01 ( aB() as boolean ) as string
end function
function Stringa01ToArrayB ( s as string ) as boolean ()
end function
Public Enum eValoriAppConfig
Archivio
RangeInizio
Rangefine
chkRuoteSel '<==========
End Enum
Function ArrayBToStringa01(aB() As Boolean) As String
Dim SB As New StringBuilder
ReDim aB(12)
For r As Integer = 1 To 12
If aB(r) = True Then
SB.Append("1")
SB.Append(".")
Else
SB.Append("0")
SB.Append(".")
End If
Next
SB.Remove(SB.Length - 1, 1)
Return SB.ToString
End Function
Function Stringa01ToArrayB(s As String) As Boolean()
Dim str() As String
Dim aB() As Boolean
Dim i As Integer
ReDim aB(12)
str = Split(s, ".")
For r = 1 To str.Length
i += 1
If str(r) = 1 Then
aB(r) = True
Else
aB(r) = False
End If
Next
ReDim Preserve aB(i)
Return aB
End Function
Function ArrayBToStringa01(aB() As Boolean) As String
Dim SB As New StringBuilder
ReDim aB(12)
For r As Integer = 1 To 12
If aB(r) = True Then
SB.Append("1")
Else
SB.Append("0")
End If
Next
Return SB.ToString
End Function
Function ArrayBToStringa01(aB() As Boolean) As String
Dim SB As New StringBuilder
For r As Integer = 1 To aB.Length
If aB(r) = True Then
SB.Append("1")
Else
SB.Append("0")
End If
Next
Return SB.ToString
End Function
Function Stringa01ToArrayB(s As String) As Boolean()
Dim str As String
Dim aB() As Boolean
Dim i As Integer
ReDim aB(12)
For r As Integer = 1 To s.Length
i += 1
str = s.Substring(r, 1)
If Val(str) = 1 Then
aB(r) = True
Else
aB(r) = False
End If
Next
ReDim Preserve aB(i)
Return aB
End Function
Function Stringa01ToArrayB(s As String) As Boolean()
Dim str As String
Dim aB() As Boolean
ReDim aB(s.Count - 1)
For r As Integer = 0 To s.Length - 1
str = s.Substring(r, 1)
If str = "1" Then
aB(r) = True
Else
aB(r) = False
End If
Next
Return aB
End Function
Ho pensato di implementare salvataggio e acquisizione impostazioni in questo modo :si solo che devi andare da 1 a 12
ReDim aB(s.length)
Imports System.Windows.Forms
Public Class frmSchermataPrincipale
Private Sub frmSchermataPrincipale_Load(sender As Object, e As EventArgs) Handles Me.Load
AggiornaStato()
CtlRangeEstrazioni1.Inizio = ConvertToInt(GetValoreCfg(eValoriAppConfig.RangeInizio))
CtlRangeEstrazioni1.Fine = ConvertToInt(GetValoreCfg(eValoriAppConfig.Rangefine))
CltSelRuote1.SetRuoteSelezionate(Stringa01ToArrayB(GetValoreCfg(eValoriAppConfig.chkRuoteSel)))
End Sub
Sub SalvaParametriCfg()
Dim aRetRuote() As Boolean
SalvaValoreCfg(eValoriAppConfig.RangeInizio, (CtlRangeEstrazioni1.Inizio).ToString)
SalvaValoreCfg(eValoriAppConfig.Rangefine, (CtlRangeEstrazioni1.Fine).ToString)
CltSelRuote1.GetRuoteSelezionate(aRetRuote)
SalvaValoreCfg(eValoriAppConfig.chkRuoteSel, ArrayBToStringa01(aRetRuote))
End Sub
Sub AggiornaStato()
CtlRangeEstrazioni1.Inizio = 1
CtlRangeEstrazioni1.Fine = ConvertToInt(cArchivio.QuantitaEstrazioni)
CtlRangeEstrazioni1.Estrazionitotali = ConvertToInt(cArchivio.QuantitaEstrazioni)
If ConvertToInt(GetValoreCfg(eValoriAppConfig.RangeInizio)) = 0 And ConvertToInt(GetValoreCfg(eValoriAppConfig.Rangefine)) = 0 Then
SalvaValoreCfg(eValoriAppConfig.RangeInizio, "1")
SalvaValoreCfg(eValoriAppConfig.Rangefine, cArchivio.QuantitaEstrazioni.ToString)
End If
If GetValoreCfg(eValoriAppConfig.chkRuoteSel) = "" Then
SalvaValoreCfg(eValoriAppConfig.chkRuoteSel, "00000000000")
End If
End Sub
Private Sub frmSchermataPrincipale_Closed(sender As Object, e As EventArgs) Handles Me.Closed
SalvaParametriCfg()
End Sub
Private Sub BrowserEstrazioniToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BrowserEstrazioniToolStripMenuItem.Click
Dim frm As New frmBroserEstr
frm.MdiParent = Me
frm.Show()
End Sub
Private Sub CtlRangeEstrazioni1_OnScegliValoreInizio() Handles CtlRangeEstrazioni1.OnScegliValoreInizio
Dim frm As New frmSelLimRange
With frm
.ScrollBarInizio.Minimum = 1
.ScrollBarInizio.Maximum = ConvertToInt(cArchivio.QuantitaEstrazioni)
.ScrollBarFine.Minimum = 1
.ScrollBarFine.Maximum = ConvertToInt(cArchivio.QuantitaEstrazioni)
.ScrollBarFine.Value = CtlRangeEstrazioni1.Fine
.ScrollBarInizio.Value = CtlRangeEstrazioni1.Inizio
.ShowDialog()
If frm.Tag = "OK" Then
CtlRangeEstrazioni1.Inizio = .ScrollBarInizio.Value
CtlRangeEstrazioni1.Fine = .ScrollBarFine.Value
End If
.Close()
.Dispose()
End With
End Sub
Private Sub CtlRangeEstrazioni1_OnScegliValoreFine() Handles CtlRangeEstrazioni1.OnScegliValoreFine
Dim frm As New frmSelLimRange
With frm
.ScrollBarInizio.Minimum = 1
.ScrollBarInizio.Maximum = ConvertToInt(cArchivio.QuantitaEstrazioni)
.ScrollBarFine.Minimum = 1
.ScrollBarFine.Maximum = ConvertToInt(cArchivio.QuantitaEstrazioni)
.ScrollBarFine.Value = CtlRangeEstrazioni1.Fine
.ScrollBarInizio.Value = CtlRangeEstrazioni1.Inizio
.ShowDialog()
If frm.Tag = "OK" Then
CtlRangeEstrazioni1.Inizio = .ScrollBarInizio.Value
CtlRangeEstrazioni1.Fine = .ScrollBarFine.Value
End If
.Close()
.Dispose()
End With
End Sub
End Class
Public Class cltSelRuote
Private Check() As CheckBox
Private Const nCheck As Integer = 12
Private Sub cltSelRuote_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LoadCampi()
End Sub
Sub LoadCampi()
Dim i As Integer
Dim nX As Integer, nY As Integer
Dim nHTxt As Integer = 15, nWTxt As Integer = 25
Dim Altezza As Integer = 21, Larghezza As Integer = 35
Dim nLeft As Integer = 10
ReDim Check(nCheck)
nX = 0
nY = 0
For r As Integer = 1 To nCheck
i += 1
Check(i) = New CheckBox
With Check(i)
.AutoSize = False
.Checked = False
.Left = nX
.Top = nY
.Width = Larghezza
.Height = Altezza
.TextAlign = ContentAlignment.MiddleCenter
.Appearance = Appearance.Button
.Text = NomiRuote(i).NomeAbbreviato
Me.Controls.Add(Check(i))
AddHandler Check(i).CheckStateChanged, AddressOf Gestione_CheckstateChanged
.Visible = True
End With
nX = nX + Larghezza
Next
End Sub
Private Sub Gestione_CheckstateChanged(sender As Object, e As EventArgs)
End Sub
Function GetRuoteSelezionate(ByRef aRetRuote() As Integer) As Integer
Dim i As Integer
ReDim aRetRuote(nCheck) ' dimensiono al massimo possibile
For x As Integer = 1 To nCheck
If Check(x).Checked = True Then
i += 1
aRetRuote(i) = x ' giusto
End If
Next
ReDim Preserve aRetRuote(i) ' ridimensiono al numero di ruote trovate
Return i
End Function
Function GetRuoteSelezionate(ByRef aRetRuote() As Boolean) As Integer
Dim i As Integer
ReDim aRetRuote(nCheck) ' dimensiono al massimo possibile
For x As Integer = 1 To nCheck
If Check(x).Checked = True Then
i += 1
aRetRuote(x) = True
End If
Next
Return i
End Function
Sub SetRuoteSelezionate(aRuote() As Integer)
For x As Integer = 1 To aRuote.Length
Check(aRuote(x)).Checked = True
Next
End Sub
Sub SetRuoteSelezionate(aRuote() As Boolean)
For x As Integer = 1 To aRuote.Length
Check(x).Checked = aRuote(x)
Next
End Sub
End Class
Function ArrayBToStringa01(aB() As Boolean) As String
Dim SB As New StringBuilder
For r As Integer = 1 To aB.Length
If aB(r) = True Then
SB.Append("1")
Else
SB.Append("0")
End If
Next
Return SB.ToString
End Function
Function Stringa01ToArrayB(s As String) As Boolean()
Dim str As String
Dim aB() As Boolean
ReDim aB(s.Length)
For r As Integer = 0 To s.Length - 1
str = s.Substring(r, 1)
If str = "1" Then
aB(r) = True
Else
aB(r) = False
End If
Next
Return aB
End Function