Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Scopri il Numero - Form1.vb

Form1.vb

Caricato da:
Scarica il programma completo

  1. Imports System
  2. Imports System.IO
  3. Imports System.Diagnostics
  4. Public Class Form1
  5.     Inherits System.Windows.Forms.Form
  6.     Dim i As Integer
  7.     Dim Number As String
  8. #Region " Windows Form Designer generated code "
  9.  
  10.     Public Sub New()
  11.         MyBase.New()
  12.  
  13.         'This call is required by the Windows Form Designer.
  14.         InitializeComponent()
  15.  
  16.         'Add any initialization after the InitializeComponent() call
  17.  
  18.     End Sub
  19.  
  20.     'Form overrides dispose to clean up the component list.
  21.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  22.         If disposing Then
  23.             If Not (components Is Nothing) Then
  24.                 components.Dispose()
  25.             End If
  26.         End If
  27.         MyBase.Dispose(disposing)
  28.     End Sub
  29.  
  30.     'Required by the Windows Form Designer
  31.     Private components As System.ComponentModel.IContainer
  32.  
  33.     'NOTE: The following procedure is required by the Windows Form Designer
  34.     'It can be modified using the Windows Form Designer.  
  35.     'Do not modify it using the code editor.
  36.     Friend WithEvents Label1 As System.Windows.Forms.Label
  37.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  38.     Friend WithEvents Button1 As System.Windows.Forms.Button
  39.     Friend WithEvents Button2 As System.Windows.Forms.Button
  40.     Friend WithEvents Button3 As System.Windows.Forms.Button
  41.     Friend WithEvents Button4 As System.Windows.Forms.Button
  42.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  43.         Me.Label1 = New System.Windows.Forms.Label
  44.         Me.TextBox1 = New System.Windows.Forms.TextBox
  45.         Me.Button1 = New System.Windows.Forms.Button
  46.         Me.Button2 = New System.Windows.Forms.Button
  47.         Me.Button3 = New System.Windows.Forms.Button
  48.         Me.Button4 = New System.Windows.Forms.Button
  49.         Me.SuspendLayout()
  50.         '
  51.         'Label1
  52.         '
  53.         Me.Label1.Location = New System.Drawing.Point(8, 8)
  54.         Me.Label1.Name = "Label1"
  55.         Me.Label1.Size = New System.Drawing.Size(160, 24)
  56.         Me.Label1.TabIndex = 0
  57.         Me.Label1.Text = "Numero Da Controllare:"
  58.         '
  59.         'TextBox1
  60.         '
  61.         Me.TextBox1.Location = New System.Drawing.Point(8, 32)
  62.         Me.TextBox1.Name = "TextBox1"
  63.         Me.TextBox1.Size = New System.Drawing.Size(152, 26)
  64.         Me.TextBox1.TabIndex = 1
  65.         Me.TextBox1.Text = "1"
  66.         '
  67.         'Button1
  68.         '
  69.         Me.Button1.Location = New System.Drawing.Point(184, 32)
  70.         Me.Button1.Name = "Button1"
  71.         Me.Button1.Size = New System.Drawing.Size(104, 24)
  72.         Me.Button1.TabIndex = 2
  73.         Me.Button1.Text = "Prova!"
  74.         '
  75.         'Button2
  76.         '
  77.         Me.Button2.Location = New System.Drawing.Point(8, 64)
  78.         Me.Button2.Name = "Button2"
  79.         Me.Button2.Size = New System.Drawing.Size(160, 24)
  80.         Me.Button2.TabIndex = 3
  81.         Me.Button2.Text = "Genera Nuovo Numero"
  82.         '
  83.         'Button3
  84.         '
  85.         Me.Button3.Location = New System.Drawing.Point(176, 64)
  86.         Me.Button3.Name = "Button3"
  87.         Me.Button3.Size = New System.Drawing.Size(112, 24)
  88.         Me.Button3.TabIndex = 4
  89.         Me.Button3.Text = "Arrenditi"
  90.         '
  91.         'Button4
  92.         '
  93.         Me.Button4.Location = New System.Drawing.Point(80, 96)
  94.         Me.Button4.Name = "Button4"
  95.         Me.Button4.Size = New System.Drawing.Size(128, 24)
  96.         Me.Button4.TabIndex = 5
  97.         Me.Button4.Text = "Esci"
  98.         '
  99.         'Form1
  100.         '
  101.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
  102.         Me.ClientSize = New System.Drawing.Size(298, 128)
  103.         Me.Controls.Add(Me.Button4)
  104.         Me.Controls.Add(Me.Button3)
  105.         Me.Controls.Add(Me.Button2)
  106.         Me.Controls.Add(Me.Button1)
  107.         Me.Controls.Add(Me.TextBox1)
  108.         Me.Controls.Add(Me.Label1)
  109.         Me.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  110.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
  111.         Me.MaximizeBox = False
  112.         Me.Name = "Form1"
  113.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  114.         Me.Text = "Scopri il Numero - By Citynova"
  115.         Me.ResumeLayout(False)
  116.  
  117.     End Sub
  118.  
  119. #End Region
  120.  
  121.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  122.         Number = InputBox("Il Numero Da Indovinare Sarà Compreso Tra 0 e:", "Scopri il Numero")
  123.         Randomize()
  124.         i = (Rnd() * Number)
  125.     End Sub
  126.  
  127.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  128.         End
  129.     End Sub
  130.  
  131.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  132.         MessageBox.Show("Hai Perso!", "Scopri il Numero")
  133.         MessageBox.Show("Il Numero Generato Dal Programma Era" & " " & i, "Scopri il Numero")
  134.     End Sub
  135.  
  136.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  137.         If i = TextBox1.Text Then
  138.             MessageBox.Show("Complimenti!Hai Indovinato il Numero!", "Scopri il Numero")
  139.         End If
  140.         If i > TextBox1.Text Then
  141.             MessageBox.Show("Numero Sbagliato!Il Numero è Maggiore Di Quello Da Te Digitato!", "Scopri il Numero")
  142.         End If
  143.         If i < TextBox1.Text Then
  144.             MessageBox.Show("Numero Sbagliato!Il Numero è Minore Di Quello Da Te Digitato!", "Scopri il Numero")
  145.         End If
  146.     End Sub
  147.  
  148.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  149.         Number = InputBox("Il Numero Da Indovinare Sarà Compreso Tra 0 e:", "Scopri il Numero")
  150.         Randomize()
  151.         i = (Rnd() * Number)
  152.     End Sub
  153. End Class