codice:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rc As Boolean
'chiamo la sub delle attività programmate
rc = leggiAttivitaProg()
Dim datGrV As DataGridView
Dim lg As Integer = CInt(login(2, 1))
Dim lgBroid As Integer = CInt(login(3, 1))
'Try
'leggo dalla tabella i miei banconi
Call caricaBanconi()
Dim xx As Integer = 0
Dim yy As Integer = 0
Dim prgInt As Integer = 1
'inizializzo la progress bar a 0
frmMainGeocall.ToolStripProgressBar1.Value = 0
'valorizzo il max value della progressbar
frmMainGeocall.ToolStripProgressBar1.Maximum = 500
For ss = 1 To strCaricabanconi.GetUpperBound(1)
xx = xx + 1
'creo automaticamente i banconi
If xx = 1 Then
frmMainGeocall.TabPage1.Text = strCaricabanconi(0, ss)
ElseIf xx = 2 Then
frmMainGeocall.TabPage2.Text = strCaricabanconi(0, ss)
Else
frmMainGeocall.TabControl1.TabPages.Add(strCaricabanconi(0, ss))
datGrV = New DataGridView
Dim ccol As Integer = frmMainGeocall.DataGridView1.Columns.Count
For zz = 0 To ccol - 1
datGrV.Columns.Add(frmMainGeocall.DataGridView1.Columns(zz).Clone)
Next
frmMainGeocall.TabControl1.TabPages(yy).Controls.Add(datGrV)
'datGrV.Cell()
datGrV.Dock = DockStyle.Fill
datGrV.DefaultCellStyle.WrapMode = DataGridViewTriState.True
datGrV.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
datGrV.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders
End If
yy = yy + 1
'leggo la tabella con i nome degli aereomobili
Call CaricaAM(strCaricabanconi(0, ss))
For tt = 1 To strCaricaAM.GetUpperBound(1)
'voli from
Call CaricaAMFrom(tt)
'voli to
Call CaricaAMTo(tt)
'carico i dati dalle tabele di geocall
For fromInd = 1 To strCaricaAMFrom.GetUpperBound(1)
For toInd = 1 To strCaricaAMTo.GetUpperBound(1)
frmMainGeocall.ToolStripProgressBar1.Value = prgInt
If xx = 1 Then
'controllo e carico il valore delle attivita programmate
Dim strAttProg As String = ""
If rc Then
For i = 0 To strAttPro.GetUpperBound(1)
If strAttPro(0, i) = strCaricaAMFrom(10, fromInd) Then
If strAttProg = "" Then
strAttProg = strAttPro(1, i)
Else
strAttProg = strAttProg & vbCrLf & strAttPro(1, i)
End If
End If
Next
End If
'scrive nella prima tabpage
frmMainGeocall.DataGridView1.Rows.Add(strCaricaAMFrom(5, fromInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMFrom(6, fromInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMFrom(7, fromInd), _
strCaricaAMFrom(0, fromInd) & vbCrLf & strCaricaAMFrom(1, fromInd), _
strCaricaAMTo(8, toInd), _
strCaricaAMFrom(4, fromInd), _
strCaricaAMTo(5, toInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMTo(6, toInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMTo(7, toInd), _
strCaricaAMTo(0, toInd) & vbCrLf & strCaricaAMTo(1, toInd), _
IIf(IsDBNull(strCaricaAMFrom(3, fromInd)), frmMainGeocall.imgACARS.Images(1), frmMainGeocall.imgACARS.Images(3)), _
IIf(IsDBNull(strCaricaAMTo(9, toInd)), "", strCaricaAMTo(9, toInd)), _
strAttProg
)
recInt += 1
If strCaricaAMFrom(3, fromInd) <> "" Then
strACARS = strCaricaAMFrom(3, fromInd)
AddHandler frmMainGeocall.DataGridView1.CellFormatting, AddressOf dgvToolTip
End If
Exit For
ElseIf xx = 2 Then
'controllo e carico il valore delle attivita programmate
Dim strAttProg As String = ""
If rc Then
For i = 0 To strAttPro.GetUpperBound(1)
If strAttPro(0, i) = strCaricaAMFrom(10, fromInd) Then
If strAttProg = "" Then
strAttProg = strAttPro(1, i)
Else
strAttProg = strAttProg & vbCrLf & strAttPro(1, i)
End If
End If
Next
End If
'scrive nella seconda tabpage
frmMainGeocall.DataGridView2.Rows.Add(strCaricaAMFrom(5, fromInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMFrom(6, fromInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMFrom(7, fromInd), _
strCaricaAMFrom(0, fromInd) & vbCrLf & strCaricaAMFrom(1, fromInd), _
strCaricaAMTo(8, toInd), _
strCaricaAMFrom(4, fromInd), _
strCaricaAMTo(5, toInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMTo(6, toInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMTo(7, toInd), _
strCaricaAMTo(0, toInd) & vbCrLf & strCaricaAMTo(1, toInd), _
IIf(IsDBNull(strCaricaAMFrom(3, fromInd)), frmMainGeocall.imgACARS.Images(1), frmMainGeocall.imgACARS.Images(3)), _
IIf(IsDBNull(strCaricaAMTo(9, toInd)), "", strCaricaAMTo(9, toInd)), _
strAttProg
)
recInt += 1
If strCaricaAMFrom(3, fromInd) <> "" Then
strACARS = strCaricaAMFrom(3, fromInd)
AddHandler frmMainGeocall.DataGridView2.CellFormatting, AddressOf dgvToolTip
End If
Exit For
Else
'controllo e carico il valore delle attivita programmate
Dim strAttProg As String = ""
If rc Then
For i = 0 To strAttPro.GetUpperBound(1)
If strAttPro(0, i) = strCaricaAMFrom(10, fromInd) Then
If strAttProg = "" Then
strAttProg = strAttPro(1, i)
Else
strAttProg = strAttProg & vbCrLf & strAttPro(1, i)
End If
End If
Next
End If
'scrive nelle tabpge create automaticamente
datGrV.Rows.Add(strCaricaAMFrom(5, fromInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMFrom(6, fromInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMFrom(7, fromInd), _
strCaricaAMFrom(0, fromInd) & vbCrLf & strCaricaAMFrom(1, fromInd), _
strCaricaAMTo(8, toInd), _
strCaricaAMFrom(4, fromInd), _
strCaricaAMTo(5, toInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMTo(6, toInd) & vbCrLf & "---------------------------------" & vbCrLf & strCaricaAMTo(7, toInd), _
strCaricaAMTo(0, toInd) & vbCrLf & strCaricaAMTo(1, toInd), _
IIf(IsDBNull(strCaricaAMFrom(3, fromInd)), frmMainGeocall.imgACARS.Images(1), frmMainGeocall.imgACARS.Images(3)), _
IIf(IsDBNull(strCaricaAMTo(9, toInd)), "", strCaricaAMTo(9, toInd)), _
strAttProg
)
recInt += 1
If strCaricaAMFrom(3, fromInd) <> "" Then
strACARS = strCaricaAMFrom(3, fromInd)
AddHandler datGrV.CellFormatting, AddressOf dgvToolTip
End If
Exit For
End If
Next
'incremento la variabile int per la progressbar
prgInt += 1
Next
recInt = 0
Next
Next
Close()
'riporto a zero il valore
frmMainGeocall.ToolStripProgressBar1.Value = 0
'rendo visibile la tabpage\tabcontrol
frmMainGeocall.TabControl1.Visible = True
'Catch ex As Exception
'MessageBox.Show("XXX.", "XXXX")
'End Try
End Sub