Torna al Thread

Private Sub caricacomune(ByVal comune As String) REM ========================================================================= REM ESEGUO IL CONTROLLO CON IL LIKE SU UNA TABELLA DI UN DATASET IN MODO TALE REM DA LAVORARE IN LOCALE SENZA ESEGUIRE QUERY IN REMOTO REM========================================================================== Dim myrow() As DataRow = Comuni.Select("Comune LIKE '" & comune.Replace("'", "''") & "%'") If myrow.Length <> 0 Then If myrow.Length = 2 Then ----FACCIO IL CONTROLLO SE SONO 2 RECORD ALLORA CI SONO 2 COMUNI CON UGAULE DESCRIZIONE Me.Panel3.Visible = True ' Create a new cell style. Dim style As New DataGridViewCellStyle With style .BackColor = Color.Beige .ForeColor = Color.Brown .Font = New Font("Verdana", 8) End With ' Apply the style as the default cell style. DataGridView1.AlternatingRowsDefaultCellStyle = style With DataGridView1 .EditMode = DataGridViewEditMode.EditOnEnter .Name = "dataGridView1" .Location = New Point(8, 8) .Size = New Size(500, 300) .AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders .ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised .CellBorderStyle = DataGridViewCellBorderStyle.Single .GridColor = SystemColors.ActiveBorder .RowHeadersVisible = False .SelectionMode = DataGridViewSelectionMode.FullRowSelect .MultiSelect = False .ReadOnly = True End With Me.DataGridView1.Rows.Clear() For i As Integer = 0 To myrow.Length - 1 Me.DataGridView1.Rows.Add() Me.DataGridView1.Rows(i).Cells(0).Value = CType(myrow(0)("Comune"), String) Me.DataGridView1.Rows(i).Cells(1).Value = CType(myrow(0)("Prov"), String) Me.DataGridView1.Rows(i).Cells(2).Value = CType(myrow(0)("CodiceComune"), String) Next i REM Exit Sub End If Me.TextBox7.Text = CType(myrow(0)("Comune"), String) Me.Label21.Text = CType(myrow(0)("Prov"), String) If CType(myrow(0)("CodiceComune"), String).Length = 4 Then Me.Label12.Text = CType(myrow(0)("CodiceComune"), String).Substring(0, 1) ElseIf CType(myrow(0)("CodiceComune"), String).Length = 5 Then Me.Label12.Text = CType(myrow(0)("CodiceComune"), String).Substring(0, 2) ElseIf CType(myrow(0)("CodiceComune"), String).Length = 6 Then Me.Label12.Text = CType(myrow(0)("CodiceComune"), String).Substring(0, 3) End If Me.TextBox7.SelectionStart = comune.Length Me.TextBox7.SelectionLength = Me.TextBox7.TextLength - comune.Length Else Me.Label21.Text = String.Empty Me.Label12.Text = String.Empty End If End Sub
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5