Ohjelmassa veikataan mikä autoista tulee ekana maaliin.
Koodia ei ole optimoitu.
En kommentoinut (en jaksanut)
form1.vb
Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Timer1 As System.Timers.Timer Friend WithEvents StatusBarPanel1 As System.Windows.Forms.StatusBarPanel Friend WithEvents StatusBarPanel2 As System.Windows.Forms.StatusBarPanel Friend WithEvents StatusBarPanel3 As System.Windows.Forms.StatusBarPanel Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents StatusBarPanel4 As System.Windows.Forms.StatusBarPanel Friend WithEvents p As System.Windows.Forms.NumericUpDown Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Friend WithEvents TrackBar1 As System.Windows.Forms.TrackBar Friend WithEvents Label10 As System.Windows.Forms.Label <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.p = New System.Windows.Forms.NumericUpDown() Me.Label9 = New System.Windows.Forms.Label() Me.RadioButton4 = New System.Windows.Forms.RadioButton() Me.RadioButton3 = New System.Windows.Forms.RadioButton() Me.RadioButton2 = New System.Windows.Forms.RadioButton() Me.RadioButton1 = New System.Windows.Forms.RadioButton() Me.Label5 = New System.Windows.Forms.Label() Me.Label6 = New System.Windows.Forms.Label() Me.Label7 = New System.Windows.Forms.Label() Me.Label8 = New System.Windows.Forms.Label() Me.Button1 = New System.Windows.Forms.Button() Me.Timer1 = New System.Timers.Timer() Me.StatusBarPanel1 = New System.Windows.Forms.StatusBarPanel() Me.StatusBarPanel2 = New System.Windows.Forms.StatusBarPanel() Me.StatusBarPanel3 = New System.Windows.Forms.StatusBarPanel() Me.StatusBar1 = New System.Windows.Forms.StatusBar() Me.StatusBarPanel4 = New System.Windows.Forms.StatusBarPanel() Me.Button2 = New System.Windows.Forms.Button() Me.ListBox1 = New System.Windows.Forms.ListBox() Me.TrackBar1 = New System.Windows.Forms.TrackBar() Me.Label10 = New System.Windows.Forms.Label() Me.GroupBox1.SuspendLayout() CType(Me.p, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Timer1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.StatusBarPanel1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.StatusBarPanel2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.StatusBarPanel3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.StatusBarPanel4, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TrackBar1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.BackColor = System.Drawing.Color.Transparent Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Label1.ForeColor = System.Drawing.Color.Red Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(40, 15) Me.Label1.TabIndex = 0 Me.Label1.Text = "Label1" ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.BackColor = System.Drawing.Color.Transparent Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Label2.ForeColor = System.Drawing.Color.Yellow Me.Label2.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label2.Location = New System.Drawing.Point(0, 24) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(40, 15) Me.Label2.TabIndex = 1 Me.Label2.Text = "Label2" ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.BackColor = System.Drawing.Color.Transparent Me.Label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Label3.ForeColor = System.Drawing.Color.Green Me.Label3.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label3.Location = New System.Drawing.Point(0, 48) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(40, 15) Me.Label3.TabIndex = 2 Me.Label3.Text = "Label3" ' 'Label4 ' Me.Label4.AutoSize = True Me.Label4.BackColor = System.Drawing.Color.Transparent Me.Label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Label4.ForeColor = System.Drawing.Color.Blue Me.Label4.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label4.Location = New System.Drawing.Point(0, 72) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(40, 15) Me.Label4.TabIndex = 3 Me.Label4.Text = "Label4" ' 'GroupBox1 ' Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.p, Me.Label9, Me.RadioButton4, Me.RadioButton3, Me.RadioButton2, Me.RadioButton1, Me.Label5, Me.Label6, Me.Label7, Me.Label8}) Me.GroupBox1.Location = New System.Drawing.Point(0, 104) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(136, 56) Me.GroupBox1.TabIndex = 4 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Mikä auto voittaa?" ' 'p ' Me.p.Location = New System.Drawing.Point(80, 32) Me.p.Maximum = New Decimal(New Integer() {20, 0, 0, 0}) Me.p.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.p.Name = "p" Me.p.ReadOnly = True Me.p.Size = New System.Drawing.Size(40, 20) Me.p.TabIndex = 13 Me.p.TextAlign = System.Windows.Forms.HorizontalAlignment.Center Me.p.ThousandsSeparator = True Me.p.Value = New Decimal(New Integer() {10, 0, 0, 0}) ' 'Label9 ' Me.Label9.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label9.Location = New System.Drawing.Point(80, 16) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(40, 16) Me.Label9.TabIndex = 12 Me.Label9.Text = "Panos:" ' 'RadioButton4 ' Me.RadioButton4.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.RadioButton4.Location = New System.Drawing.Point(40, 32) Me.RadioButton4.Name = "RadioButton4" Me.RadioButton4.Size = New System.Drawing.Size(16, 16) Me.RadioButton4.TabIndex = 11 ' 'RadioButton3 ' Me.RadioButton3.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.RadioButton3.Location = New System.Drawing.Point(40, 16) Me.RadioButton3.Name = "RadioButton3" Me.RadioButton3.Size = New System.Drawing.Size(16, 16) Me.RadioButton3.TabIndex = 10 ' 'RadioButton2 ' Me.RadioButton2.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.RadioButton2.Location = New System.Drawing.Point(8, 32) Me.RadioButton2.Name = "RadioButton2" Me.RadioButton2.Size = New System.Drawing.Size(16, 16) Me.RadioButton2.TabIndex = 9 ' 'RadioButton1 ' Me.RadioButton1.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.RadioButton1.Location = New System.Drawing.Point(8, 16) Me.RadioButton1.Name = "RadioButton1" Me.RadioButton1.Size = New System.Drawing.Size(16, 16) Me.RadioButton1.TabIndex = 8 ' 'Label5 ' Me.Label5.ForeColor = System.Drawing.Color.Blue Me.Label5.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label5.Location = New System.Drawing.Point(56, 32) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(16, 16) Me.Label5.TabIndex = 7 Me.Label5.Text = "4" ' 'Label6 ' Me.Label6.ForeColor = System.Drawing.Color.Green Me.Label6.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label6.Location = New System.Drawing.Point(56, 16) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(16, 16) Me.Label6.TabIndex = 6 Me.Label6.Text = "3" ' 'Label7 ' Me.Label7.ForeColor = System.Drawing.Color.Yellow Me.Label7.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label7.Location = New System.Drawing.Point(24, 32) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(16, 16) Me.Label7.TabIndex = 5 Me.Label7.Text = "2" ' 'Label8 ' Me.Label8.ForeColor = System.Drawing.Color.Red Me.Label8.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Label8.Location = New System.Drawing.Point(24, 16) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(16, 16) Me.Label8.TabIndex = 4 Me.Label8.Text = "1" ' 'Button1 ' Me.Button1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton Me.Button1.BackColor = System.Drawing.Color.Transparent Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button1.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Button1.Location = New System.Drawing.Point(0, 160) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(56, 24) Me.Button1.TabIndex = 5 Me.Button1.Text = "Veikkaa" ' 'Timer1 ' Me.Timer1.Interval = 500 Me.Timer1.SynchronizingObject = Me ' 'StatusBarPanel1 ' Me.StatusBarPanel1.Text = "Tulos: " Me.StatusBarPanel1.Width = 160 ' 'StatusBarPanel2 ' Me.StatusBarPanel2.Text = "Oikeat: 0 (0%)" Me.StatusBarPanel2.Width = 160 ' 'StatusBarPanel3 ' Me.StatusBarPanel3.MinWidth = 1 Me.StatusBarPanel3.Text = "Väärät: 0 (0%)" Me.StatusBarPanel3.Width = 1 ' 'StatusBar1 ' Me.StatusBar1.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.StatusBar1.Location = New System.Drawing.Point(0, 176) Me.StatusBar1.Name = "StatusBar1" Me.StatusBar1.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.StatusBarPanel1, Me.StatusBarPanel2, Me.StatusBarPanel3, Me.StatusBarPanel4}) Me.StatusBar1.ShowPanels = True Me.StatusBar1.Size = New System.Drawing.Size(442, 16) Me.StatusBar1.TabIndex = 11 ' 'StatusBarPanel4 ' Me.StatusBarPanel4.Text = "StatusBarPanel4" ' 'Button2 ' Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button2.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.Button2.Location = New System.Drawing.Point(64, 160) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(56, 24) Me.Button2.TabIndex = 12 Me.Button2.Text = "Lopeta" ' 'ListBox1 ' Me.ListBox1.Location = New System.Drawing.Point(144, 104) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(88, 69) Me.ListBox1.TabIndex = 14 ' 'TrackBar1 ' Me.TrackBar1.LargeChange = 30 Me.TrackBar1.Location = New System.Drawing.Point(232, 120) Me.TrackBar1.Maximum = 1600 Me.TrackBar1.Minimum = 400 Me.TrackBar1.Name = "TrackBar1" Me.TrackBar1.RightToLeft = System.Windows.Forms.RightToLeft.Yes Me.TrackBar1.Size = New System.Drawing.Size(216, 45) Me.TrackBar1.SmallChange = 100 Me.TrackBar1.TabIndex = 15 Me.TrackBar1.TickFrequency = 100 Me.TrackBar1.Value = 500 ' 'Label10 ' Me.Label10.Location = New System.Drawing.Point(240, 160) Me.Label10.Name = "Label10" Me.Label10.Size = New System.Drawing.Size(200, 16) Me.Label10.TabIndex = 16 Me.Label10.Text = "Hidas Nopea " ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(442, 192) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label10, Me.TrackBar1, Me.ListBox1, Me.Button2, Me.StatusBar1, Me.Button1, Me.GroupBox1, Me.Label4, Me.Label3, Me.Label2, Me.Label1}) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.KeyPreview = True Me.MaximizeBox = False Me.MaximumSize = New System.Drawing.Size(448, 224) Me.MinimizeBox = False Me.MinimumSize = New System.Drawing.Size(448, 224) Me.Name = "Form1" Me.Opacity = 0.89999997615814209 Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Auto veikkaus" Me.TransparencyKey = System.Drawing.Color.Goldenrod Me.GroupBox1.ResumeLayout(False) CType(Me.p, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Timer1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.StatusBarPanel1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.StatusBarPanel2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.StatusBarPanel3, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.StatusBarPanel4, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TrackBar1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Dim maali As System.Drawing.Graphics Dim vari As New System.Drawing.Pen(System.Drawing.Color.Black, 5) Dim fa As System.Drawing.Drawing2D.GraphicsState() Dim a As Integer Dim vaara As Integer Dim Oikea As Integer Dim v As Integer Dim raha As Integer Dim panos As Integer Dim jarj(3) As Array Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load raha = 1000 StatusBarPanel4.Text = "Rahat: " & raha & "€" maali = Me.CreateGraphics maali.DrawLine(vari, 424, 0, 424, 90) Label1.Text = "1 -->" Label2.Text = "2 -->" Label3.Text = "3 -->" Label4.Text = "4 -->" vaara = 0 Oikea = 0 End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged a = 1 End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged a = 2 End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged a = 3 End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged a = 4 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' MsgBox("Veikkasit autoa " & a) panos = p.Value() raha = raha - panos If raha < panos Then MsgBox("Rahasi loppu") raha = raha + panos Exit Sub End If Timer1.Enabled = True ' Timer1.Interval = 600 Label1.Left = 0 Label2.Left = 0 Label3.Left = 0 Label4.Left = 0 Label1.Refresh() Label2.Refresh() Label3.Refresh() Label4.Refresh() v = 0 End Sub Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed Randomize() Label1.Left = Label1.Left + Int((10 - 5 + 1) * Rnd() + 5) If v = 0 Then If Label1.Left > 424 Then v = 1 End If End If Label2.Left = Label2.Left + Int((10 - 5 + 1) * Rnd() + 5) If v = 0 Then If Label2.Left > 424 Then v = 2 End If End If Label3.Left = Label3.Left + Int((10 - 5 + 1) * Rnd() + 5) If v = 0 Then If Label3.Left > 424 Then v = 3 End If End If Label4.Left = Label4.Left + Int((10 - 5 + 1) * Rnd() + 5) If v = 0 Then If Label4.Left > 424 Then v = 4 End If End If Label1.Refresh() Label2.Refresh() Label3.Refresh() Label4.Refresh() Dim jarj(3) As Integer jarj(0) = Label1.Left jarj(1) = Label2.Left jarj(2) = Label3.Left jarj(3) = Label4.Left jarj.Sort(jarj) Label1.Text = jarj.BinarySearch(jarj, Label1.Left) Label2.Text = jarj.BinarySearch(jarj, Label2.Left) Label3.Text = jarj.BinarySearch(jarj, Label3.Left) Label4.Text = jarj.BinarySearch(jarj, Label4.Left) If Label1.Text = 3 Then Label1.Text = 1 & " -->" ElseIf Label1.Text = 2 Then Label1.Text = 2 & " -->" ElseIf Label1.Text = 1 Then Label1.Text = 3 & " -->" ElseIf Label1.Text = 0 Then Label1.Text = 4 & " -->" End If If Label2.Text = 3 Then Label2.Text = 1 & " -->" ElseIf Label2.Text = 2 Then Label2.Text = 2 & " -->" ElseIf Label2.Text = 1 Then Label2.Text = 3 & " -->" ElseIf Label2.Text = 0 Then Label2.Text = 4 & " -->" End If If Label3.Text = 3 Then Label3.Text = 1 & " -->" ElseIf Label3.Text = 2 Then Label3.Text = 2 & " -->" ElseIf Label3.Text = 1 Then Label3.Text = 3 & " -->" ElseIf Label3.Text = 0 Then Label3.Text = 4 & " -->" End If If Label4.Text = 3 Then Label4.Text = 1 & " -->" ElseIf Label4.Text = 2 Then Label4.Text = 2 & " -->" ElseIf Label4.Text = 1 Then Label4.Text = 3 & " -->" ElseIf Label4.Text = 0 Then Label4.Text = 4 & " -->" End If ListBox1.Items.Clear() ListBox1.Items.Add("1. " & jarj(3)) ListBox1.Items.Add("2. " & jarj(2)) ListBox1.Items.Add("3. " & jarj(1)) ListBox1.Items.Add("4. " & jarj(0)) 'Label1.Text.Replace("4", "1") 'Label1.Text.Replace("3", "2") 'Label1.Text.Replace("2", "3") 'Label1.Text.Replace("1", "4") 'Label2.Text.Replace("4", "1") 'Label2.Text.Replace("3", "2") 'Label2.Text.Replace("2", "3") 'Label2.Text.Replace("1", "4") 'Label3.Text.Replace("4", "1") 'Label3.Text.Replace("3", "2") 'Label3.Text.Replace("2", "3") 'Label3.Text.Replace("1", "4") 'Label4.Text.Replace("4", "1") 'Label4.Text.Replace("3", "2") 'Label4.Text.Replace("2", "3") 'Label4.Text.Replace("1", "4") ' If Label1.Left >= 424 Then 'If a = 1 Then ' StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" ' Timer1.Enabled = False ' Exit Sub 'Else ' StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" ' Timer1.Enabled = False ' Exit Sub 'End If 'Timer1.Enabled = False 'Exit Sub ' ' ElseIf Label2.Left >= 424 Then ' If a = 2 Then ' StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" ' Timer1.Enabled = False ' Exit Sub ' Else ' StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" ' Timer1.Enabled = False ' Exit Sub 'End If 'Timer1.Enabled = False 'ElseIf Label3.Left >= 424 Then 'If a = 3 Then 'StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" 'Timer1.Enabled = False 'Exit Sub 'Else ' StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" ' Timer1.Enabled = False ' Exit Sub 'End If 'Timer1.Enabled = False 'ElseIf Label4.Left >= 424 Then ' If a = 4 Then 'StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" 'Timer1.Enabled = False 'Exit Sub 'Else ' StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" ' Timer1.Enabled = False ' Exit Sub 'End If 'Timer1.Enabled = False 'Else ' 'End If If v > 0 Then If v = 1 Then If a = 1 Then StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" Timer1.Enabled = False Oikea = Oikea + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" raha = raha + (panos * Int((100 - 1 + 1) * Rnd() + 1)) Exit Sub Else StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" vaara = vaara + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" Timer1.Enabled = False Exit Sub End If ElseIf v = 2 Then If a = 2 Then StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" Timer1.Enabled = False Oikea = Oikea + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" raha = raha + (panos * Int((100 - 1 + 1) * Rnd() + 1)) Exit Sub Else StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" vaara = vaara + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" Timer1.Enabled = False Exit Sub End If ElseIf v = 3 Then If a = 3 Then StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" Oikea = Oikea + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" raha = raha + (panos * Int((100 - 1 + 1) * Rnd() + 1)) Timer1.Enabled = False Exit Sub Else StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" vaara = vaara + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" Timer1.Enabled = False Exit Sub End If ElseIf v = 4 Then If a = 4 Then StatusBar1.Panels(0).Text = "Tulos: Veikkasit oikein" Timer1.Enabled = False Oikea = Oikea + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" raha = raha + (panos * Int((100 - 1 + 1) * Rnd() + 1)) Exit Sub Else StatusBar1.Panels(0).Text = "Tulos: Veikkasit väärin" vaara = vaara + 1 Dim pro As Integer Dim pro2 As Integer If vaara = 0 Then pro = 100 Else pro = Oikea / (Oikea + vaara) * 100 End If If Oikea = 0 Then pro2 = 100 Else pro2 = vaara / (Oikea + vaara) * 100 End If StatusBar1.Panels(1).Text = "Oikeat: " & Oikea & " ( " & pro & ")" StatusBar1.Panels(2).Text = "Väärät: " & vaara & " ( " & pro2 & ")" Timer1.Enabled = False Exit Sub End If End If End If End Sub Private Sub GroupBox7_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint maali = Me.CreateGraphics maali.DrawLine(vari, 424, 0, 424, 90) maali.DrawLine(vari, 0, 16, 440, 16) maali.DrawLine(vari, 0, 40, 440, 40) maali.DrawLine(vari, 0, 64, 440, 64) maali.DrawLine(vari, 0, 88, 440, 88) Label1.Update() Label2.Update() Label3.Update() Label4.Update() StatusBarPanel4.Text = "Rahat: " & raha & "€" End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Form1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseHover End Sub Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub Private Sub Form1_ChangeUICues(ByVal sender As Object, ByVal e As System.Windows.Forms.UICuesEventArgs) Handles MyBase.ChangeUICues End Sub Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll Timer1.Interval = TrackBar1.Value End Sub End Class
form1.resx
<?xml version="1.0" encoding="utf-8" ?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used for serialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="Label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="GroupBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="p.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label9.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="RadioButton4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="RadioButton3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="RadioButton2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="RadioButton1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label5.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label6.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label7.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label8.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Timer1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </data> <data name="Timer1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="StatusBarPanel1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="StatusBarPanel2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="StatusBarPanel3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="StatusBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="StatusBarPanel4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="ListBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TrackBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label10.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="$this.Name"> <value>Form1</value> </data> </root>
Koodihan on sitten vb .net:illä tehtyä (eli vb7)
Aihe on jo aika vanha, joten et voi enää vastata siihen.