это первый раз, когда я пытаюсь что-нибудь на этом языке или приложениях в любом случае.Я только что установил c # и не могу заставить этот код выполнить простое изменение значения.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
progressBar1.Value = 22;
MessageBox.Show("completed!");
}
}
}
namespace WindowsFormsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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.progressBar1 = new System.Windows.Forms.ProgressBar();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(42, 309);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(428, 54);
this.progressBar1.TabIndex = 0;
this.progressBar1.Value = 55;
//
// button1
//
this.button1.Location = new System.Drawing.Point(42, 48);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(428, 45);
this.button1.TabIndex = 1;
this.button1.Text = "start";
this.button1.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(525, 409);
this.Controls.Add(this.button1);
this.Controls.Add(this.progressBar1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button button1;
}
}
Все, что я сделал, это добавил
progressBar1.Value = 22;
MessageBox.Show("completed!");
, но когда я нажимаю на button1, ничего не происходит.
Кстати, весь этот код был создан программным обеспечением, разве так люди развиваются?Я думал, что это был весь код без «помощи», это похоже на меня 10 лет назад, когда я впервые начал с HTML, и frontpage сделал весь код для меня.:)