Public Function Ritorna_Formato_Numerico(ByRef ln As Int32) As String
Dim len As String = CStr(ln)
Dim lenStr As Short = len.Length
Dim FormatoStringa As String = "{0:00}"
Select Case lenStr
Case 1
FormatoStringa = "{0:0}"
Case 2
FormatoStringa = "{0:00}"
Case 3
FormatoStringa = "{0:000}"
Case 4
FormatoStringa = "{0:0000}"
Case 5
FormatoStringa = "{0:00000}"
Case 6
FormatoStringa = "{0:000000}"
End Select
Return FormatoStringa
End Function
Private Sub ButtonVisual2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVisual2.Click
Dim i4 As Integer
Dim j4 As Integer
Dim Testo As String
Testo = CStr("")
'utilizzo della funzione per il formato numerico
Dim Formato As String = Ritorna_Formato_Numerico(Tnum)
For i4 = 1 To r
Testo = CStr("")
For j4 = 1 To c
Testo = Testo & " " & String.Format(Formato, matrice2(i4, j4))
Next j4
Me.ListBox1.Items.Add(Testo)
Next i4
Me.ButtonGenera.BackColor = Color.GreenYellow
Me.ButtonGenera2.BackColor = Color.Olive
Me.ButtonGenera2.Enabled = True
Me.ButtonGenera.Enabled = True
Me.Btn_Ripeti.Visible = True
End Sub
Private Sub ButtonVisual1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVisual1.Click
Dim i3 As Integer
Dim j3 As Integer
Dim Testo As String
Testo = CStr("")
'utilizzo della funzione per il formato numerico
Dim Formato As String = Ritorna_Formato_Numerico(Tnum)
If Metodo = 2 Then
Me.TextBox1.Text = TextBox1.Text + "By Ultimo------MATRICE--- " & r & " X " & c & " -------------------------------. . . . . . . . ."
Me.TextBox1.Text = TextBox1.Text + vbNewLine
For i3 = 1 To r
Testo = CStr("")
For j3 = 1 To c
Testo = Testo & " " & String.Format(Formato, matrice2(i3, j3))
Next j3
TextBox1.Text = TextBox1.Text + Testo
TextBox1.Text = TextBox1.Text + vbNewLine
Next i3
Me.TextBox1.Text = TextBox1.Text + "By Ultimo------------------------------------------------. . . . . . . . . . ."
Me.TextBox1.Text = TextBox1.Text + vbNewLine + vbNewLine
Me.ButtonGenera.BackColor = Color.GreenYellow
Me.ButtonGenera2.BackColor = Color.Olive
Me.ButtonGenera2.Enabled = True
Me.ButtonGenera.Enabled = True
Me.Btn_Ripeti.Visible = True
Else
Me.TextBox1.Text = TextBox1.Text + "By Ultimo------MATRICE--- " & r & " X " & c & " -------------------------------------. . . . . . . . . . ."
Me.TextBox1.Text = TextBox1.Text + vbNewLine
For i3 = 1 To r
For j3 = 1 To c
TextBox1.Text = TextBox1.Text + " " & CStr(matrice2(i3, j3))
Next j3
TextBox1.Text = TextBox1.Text + vbNewLine
Next i3
Me.TextBox1.Text = TextBox1.Text + "By Ultimo------------------------------------------------. . . . . . . . . . ."
Me.TextBox1.Text = TextBox1.Text + vbNewLine + vbNewLine
Me.ButtonGenera.BackColor = Color.GreenYellow
Me.ButtonGenera2.BackColor = Color.Olive
Me.ButtonGenera2.Enabled = True
Me.ButtonGenera.Enabled = True
Me.Btn_Ripeti.Visible = True
End If
End Sub