Im trying to build this solution and getting many errors in form1.cs and in the form1 designer cant

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
This is the code of the Form1.cs:


<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; using System;
<span style="color:Blue; using System.Drawing;
<span style="color:Blue; using System.Collections;
<span style="color:Blue; using System.ComponentModel;
<span style="color:Blue; using System.Windows.Forms;
<span style="color:Blue; using System.Data;

<span style="color:Blue; namespace VistaStyleProgressBar
{
<span style="color:Gray; /// <span style="color:Gray; <summary>
<span style="color:Gray; ///<span style="color:Green; Summary description for Form1.
<span style="color:Gray; /// <span style="color:Gray; </summary>
<span style="color:Blue; public <span style="color:Blue; class Form1 : System.Windows.Forms.Form
{
<span style="color:Blue; private VistaStyleProgressBar.ProgressBar progressBar1;
<span style="color:Blue; private VistaStyleProgressBar.ProgressBar progressBar2;
<span style="color:Blue; private VistaStyleProgressBar.ProgressBar progressBar3;
<span style="color:Blue; private VistaStyleProgressBar.ProgressBar progressBar4;
<span style="color:Blue; private VistaStyleProgressBar.ProgressBar progressBar5;
<span style="color:Blue; private System.Windows.Forms.Timer timer1;
<span style="color:Blue; private System.ComponentModel.IContainer components;

<span style="color:Blue; public Form1()
{
<span style="color:Green; //
<span style="color:Green; // Required for Windows Form Designer support
<span style="color:Green; //
InitializeComponent();

<span style="color:Green; //
<span style="color:Green; // TODO: Add any constructor code after InitializeComponent call
<span style="color:Green; //
}

<span style="color:Gray; /// <span style="color:Gray; <summary>
<span style="color:Gray; ///<span style="color:Green; Clean up any resources being used.
<span style="color:Gray; /// <span style="color:Gray; </summary>
<span style="color:Blue; protected <span style="color:Blue; override <span style="color:Blue; void Dispose( <span style="color:Blue; bool disposing )
{
<span style="color:Blue; if( disposing )
{
<span style="color:Blue; if (components != <span style="color:Blue; null)
{
components.Dispose();
}
}
<span style="color:Blue; base.Dispose( disposing );
}

<span style="color:Blue; #region Windows Form Designer generated code
<span style="color:Gray; /// <span style="color:Gray; <summary>
<span style="color:Gray; ///<span style="color:Green; Required method for Designer support - do not modify
<span style="color:Gray; ///<span style="color:Green; the contents of this method with the code editor.
<span style="color:Gray; /// <span style="color:Gray; </summary>
<span style="color:Blue; private <span style="color:Blue; void InitializeComponent()
{
<span style="color:Blue; this.components = <span style="color:Blue; new System.ComponentModel.Container();
<span style="color:Blue; this.progressBar1 = <span style="color:Blue; new VistaStyleProgressBar.ProgressBar();
<span style="color:Blue; this.progressBar2 = <span style="color:Blue; new VistaStyleProgressBar.ProgressBar();
<span style="color:Blue; this.progressBar3 = <span style="color:Blue; new VistaStyleProgressBar.ProgressBar();
<span style="color:Blue; this.progressBar4 = <span style="color:Blue; new VistaStyleProgressBar.ProgressBar();
<span style="color:Blue; this.progressBar5 = <span style="color:Blue; new VistaStyleProgressBar.ProgressBar();
<span style="color:Blue; this.timer1 = <span style="color:Blue; new System.Windows.Forms.Timer(<span style="color:Blue; this.components);
<span style="color:Blue; this.SuspendLayout();
<span style="color:Green; //
<span style="color:Green; // progressBar1
<span style="color:Green; //
<span style="color:Blue; this.progressBar1.BackColor = System.Drawing.Color.Transparent;
<span style="color:Blue; this.progressBar1.BackgroundColor = System.Drawing.Color.Transparent;
<span style="color:Blue; this.progressBar1.Location = <span style="color:Blue; new System.Drawing.Point(8, 8);
<span style="color:Blue; this.progressBar1.Name = <span style="color:#A31515; "progressBar1";
<span style="color:Blue; this.progressBar1.Size = <span style="color:Blue; new System.Drawing.Size(384, 32);
<span style="color:Blue; this.progressBar1.TabIndex = 0;
<span style="color:Blue; this.progressBar1.Value = 20;
<span style="color:Green; //
<span style="color:Green; // progressBar2
<span style="color:Green; //
<span style="color:Blue; this.progressBar2.BackColor = System.Drawing.Color.Transparent;
<span style="color:Blue; this.progressBar2.BackgroundColor = System.Drawing.Color.FromArgb(((System.Byte)(100)), ((System.Byte)(201)), ((System.Byte)(201)), ((System.Byte)(201)));
<span style="color:Blue; this.progressBar2.EndColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(163)), ((System.Byte)(211)));
<span style="color:Blue; this.progressBar2.HighlightColor = System.Drawing.Color.Orange;
<span style="color:Blue; this.progressBar2.Location = <span style="color:Blue; new System.Drawing.Point(8, 48);
<span style="color:Blue; this.progressBar2.Name = <span style="color:#A31515; "progressBar2";
<span style="color:Blue; this.progressBar2.Size = <span style="color:Blue; new System.Drawing.Size(384, 32);
<span style="color:Blue; this.progressBar2.StartColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(211)), ((System.Byte)(40)));
<span style="color:Blue; this.progressBar2.TabIndex = 0;
<span style="color:Blue; this.progressBar2.Value = 40;
<span style="color:Green; //
<span style="color:Green; // progressBar3
<span style="color:Green; //
<span style="color:Blue; this.progressBar3.BackColor = System.Drawing.Color.Transparent;
<span style="color:Blue; this.progressBar3.BackgroundColor = System.Drawing.Color.FromArgb(((System.Byte)(150)), ((System.Byte)(201)), ((System.Byte)(201)), ((System.Byte)(201)));
<span style="color:Blue; this.progressBar3.EndColor = System.Drawing.Color.FromArgb(((System.Byte)(210)), ((System.Byte)(202)), ((System.Byte)(0)));
<span style="color:Blue; this.progressBar3.Location = <span style="color:Blue; new System.Drawing.Point(8, 88);
<span style="color:Blue; this.progressBar3.Name = <span style="color:#A31515; "progressBar3";
<span style="color:Blue; this.progressBar3.Size = <span style="color:Blue; new System.Drawing.Size(384, 32);
<span style="color:Blue; this.progressBar3.StartColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(163)), ((System.Byte)(211)));
<span style="color:Blue; this.progressBar3.TabIndex = 0;
<span style="color:Blue; this.progressBar3.Value = 60;
<span style="color:Green; //
<span style="color:Green; // progressBar4
<span style="color:Green; //
<span style="color:Blue; this.progressBar4.BackColor = System.Drawing.Color.Transparent;
<span style="color:Blue; this.progressBar4.BackgroundColor = System.Drawing.Color.FromArgb(((System.Byte)(200)), ((System.Byte)(201)), ((System.Byte)(201)), ((System.Byte)(201)));
<span style="color:Blue; this.progressBar4.Location = <span style="color:Blue; new System.Drawing.Point(8, 128);
<span style="color:Blue; this.progressBar4.Name = <span style="color:#A31515; "progressBar4";
<span style="color:Blue; this.progressBar4.Size = <span style="color:Blue; new System.Drawing.Size(384, 32);
<span style="color:Blue; this.progressBar4.StartColor = System.Drawing.Color.FromArgb(((System.Byte)(210)), ((System.Byte)(202)), ((System.Byte)(0)));
<span style="color:Blue; this.progressBar4.TabIndex = 0;
<span style="color:Blue; this.progressBar4.Value = 80;
<span style="color:Green; //
<span style="color:Green; // progressBar5
<span style="color:Green; //
<span style="color:Blue; this.progressBar5.BackColor = System.Drawing.Color.Transparent;
<span style="color:Blue; this.progressBar5.EndColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(163)), ((System.Byte)(211)));
<span style="color:Blue; this.progressBar5.Location = <span style="color:Blue; new System.Drawing.Point(8, 168);
<span style="color:Blue; this.progressBar5.Name = <span style="color:#A31515; "progressBar5";
<span style="color:Blue; this.progressBar5.Size = <span style="color:Blue; new System.Drawing.Size(384, 32);
<span style="color:Blue; this.progressBar5.StartColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(211)), ((System.Byte)(40)));
<span style="color:Blue; this.progressBar5.TabIndex = 0;
<span style="color:Blue; this.progressBar5.Value = 100;
<span style="color:Green; //
<span style="color:Green; // timer1
<span style="color:Green; //
<span style="color:Blue; this.timer1.Enabled = <span style="color:Blue; true;
<span style="color:Blue; this.timer1.Interval = 50;
<span style="color:Blue; this.timer1.Tick += <span style="color:Blue; new System.EventHandler(<span style="color:Blue; this.timer1_Tick);
<span style="color:Green; //
<span style="color:Green; // Form1
<span style="color:Green; //
<span style="color:Blue; this.AutoScaleBaseSize = <span style="color:Blue; new System.Drawing.Size(5, 13);
<span style="color:Blue; this.ClientSize = <span style="color:Blue; new System.Drawing.Size(400, 212);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.progressBar1);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.progressBar2);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.progressBar3);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.progressBar4);
<span style="color:Blue; this.Controls.Add(<span style="color:Blue; this.progressBar5);
<span style="color:Blue; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
<span style="color:Blue; this.MaximizeBox = <span style="color:Blue; false;
<span style="color:Blue; this.Name = <span style="color:#A31515; "Form1";
<span style="color:Blue; this.Text = <span style="color:#A31515; "Vista Style Progress Bar Demo";
<span style="color:Blue; this.ResumeLayout(<span style="color:Blue; false);

}
<span style="color:Blue; #endregion

<span style="color:Gray; /// <span style="color:Gray; <summary>
<span style="color:Gray; ///<span style="color:Green; The main entry point for the application.
<span style="color:Gray; /// <span style="color:Gray; </summary>
[STAThread]
<span style="color:Blue; static <span style="color:Blue; void Main()
{
Application.Run(<span style="color:Blue; new Form1());
}

<span style="color:Blue; bool u1 = <span style="color:Blue; true;
<span style="color:Blue; bool u2 = <span style="color:Blue; true;
<span style="color:Blue; bool u3 = <span style="color:Blue; true;
<span style="color:Blue; bool u4 = <span style="color:Blue; true;
<span style="color:Blue; bool u5 = <span style="color:Blue; true;

<span style="color:Blue; private <span style="color:Blue; void timer1_Tick(<span style="color:Blue; object sender, System.EventArgs e)
{
<span style="color:Blue; if (progressBar1.Value >= progressBar1.MaxValue) {u1 = <span style="color:Blue; false;}
<span style="color:Blue; if (progressBar1.Value <= progressBar1.MinValue) {u1 = <span style="color:Blue; true;}

<span style="color:Blue; if (progressBar2.Value >= progressBar2.MaxValue) {u2 = <span style="color:Blue; false;}
<span style="color:Blue; if (progressBar2.Value <= progressBar2.MinValue) {u2 = <span style="color:Blue; true;}

<span style="color:Blue; if (progressBar3.Value >= progressBar3.MaxValue) {u3 = <span style="color:Blue; false;}
<span style="color:Blue; if (progressBar3.Value <= progressBar3.MinValue) {u3 = <span style="color:Blue; true;}

<span style="color:Blue; if (progressBar4.Value >= progressBar4.MaxValue) {u4 = <span style="color:Blue; false;}
<span style="color:Blue; if (progressBar4.Value <= progressBar4.MinValue) {u4 = <span style="color:Blue; true;}

<span style="color:Blue; if (progressBar5.Value >= progressBar5.MaxValue) {u5 = <span style="color:Blue; false;}
<span style="color:Blue; if (progressBar5.Value <= progressBar5.MinValue) {u5 = <span style="color:Blue; true;}

<span style="color:Blue; if (u1) {progressBar1.Value += 1;} <span style="color:Blue; else {progressBar1.Value -= 1;}
<span style="color:Blue; if (u2) {progressBar2.Value += 1;} <span style="color:Blue; else {progressBar2.Value -= 1;}
<span style="color:Blue; if (u3) {progressBar3.Value += 1;} <span style="color:Blue; else {progressBar3.Value -= 1;}
<span style="color:Blue; if (u4) {progressBar4.Value += 1;} <span style="color:Blue; else {progressBar4.Value -= 1;}
<span style="color:Blue; if (u5) {progressBar5.Value += 1;} <span style="color:Blue; else {progressBar5.Value -= 1;}
}

}
}

[/code]

Im getting many warnings each one say: Warning 1 Could not find type VistaStyleProgressBar.ProgressBar. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project,
make sure that the project has been successfully built using settings for your current platform or Any CPU. 0 0
I checked the project is set to Any CPU im using visual studio express 2010 .net 4

In the Form1 designer i dont see the designer only errors on top 5 instance errors: There is no stack trace or error line information available for this error.
Under this 5 errors i see:

The variable progressBar1 is either underclared or was never assigned
And this error is for all the 5 progressBars

Whats wrong ? ( I had to convert the code to visual studio 2010 ).

Thanks.
<hr class="sig danieli

View the full article
 
Back
Top