תיקון קוד ב-WIN APP
בקשה קטנה לפני שהגאונים יפתרו(אני רק בקורס הראשון של תכנות), זה מה שאני יודעת , אני מנסה להבין טעויות, ולא דברים חדשים שיסבכו אותי יותר. המטרה: יש לכתובת תוכנית הקולטת מהמשתמש מספר בין 1 ל- 100. התוכנית מייצרת סדרה של "הגרלות" מספרים בין 1 לבין 100 וסופרת כמה הגרלות כאלו היו עד שעלה בגורל המספר שהמשתמש הכניס (הספירה כוללת גם את ההגרלה האחרונה שבה כאמור יצא המספר הנדרש). לדוגמה אם המשתמש הקיש את הערך 2 וההגרלות היו: 99,40,11,3,2 אזי התוכנית תודיע – 5. הקוד:
בקשה קטנה לפני שהגאונים יפתרו(אני רק בקורס הראשון של תכנות), זה מה שאני יודעת , אני מנסה להבין טעויות, ולא דברים חדשים שיסבכו אותי יותר. המטרה: יש לכתובת תוכנית הקולטת מהמשתמש מספר בין 1 ל- 100. התוכנית מייצרת סדרה של "הגרלות" מספרים בין 1 לבין 100 וסופרת כמה הגרלות כאלו היו עד שעלה בגורל המספר שהמשתמש הכניס (הספירה כוללת גם את ההגרלה האחרונה שבה כאמור יצא המספר הנדרש). לדוגמה אם המשתמש הקיש את הערך 2 וההגרלות היו: 99,40,11,3,2 אזי התוכנית תודיע – 5. הקוד:
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace hw5_1 { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button btn; private System.Windows.Forms.TextBox txtnum; private System.Windows.Forms.Label lblround; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btn = new System.Windows.Forms.Button(); this.txtnum = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.lblround = new System.Windows.Forms.Label(); this.SuspendLayout(); // // btn // this.btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(177))); this.btn.Location = new System.Drawing.Point(232, 112); this.btn.Name = "btn"; this.btn.Size = new System.Drawing.Size(232, 48); this.btn.TabIndex = 0; this.btn.Text = "לחץ לבדיקת מספר הסיבובים עד הזכיה"; this.btn.Click += new System.EventHandler(this.btn_Click); // // txtnum // this.txtnum.Location = new System.Drawing.Point(272, 64); this.txtnum.Name = "txtnum"; this.txtnum.TabIndex = 1; this.txtnum.Text = ""; this.txtnum.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // label1 // this.label1.Location = new System.Drawing.Point(376, 64); this.label1.Name = "label1"; this.label1.RightToLeft = System.Windows.Forms.RightToLeft