C sharp - Tutorial incompleto?

 
Vista:
sin imagen de perfil
Val: 30
Ha disminuido su posición en 9 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Flash (21 intervenciones) el 09/08/2016 15:50:11
Buenas y siento molestar con esto pero estoy estudiando c# (que ya pregunte aqui anteriormente) y no hace cambios ni nada o no se si mal lei el tutorial

http://www.tutorialesprogramacionya.com/csharpya/detalleconcepto.php?codigo=164&inicio=20

Hago exactamente el mismo codigo pero no hace nada.
¿Hay que añadirle algo mas a lo que pone? no puedo hacer ninguno de los problemas ahora mismo tengo esto

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
1º ARCHIVO
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.button1 = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.comboBox2 = new System.Windows.Forms.ComboBox();
            this.comboBox3 = new System.Windows.Forms.ComboBox();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(77, 174);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "Actualizar";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(27, 43);
            this.label1.Name = "Color1";
            this.label1.Size = new System.Drawing.Size(35, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Rojo";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(30, 85);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(35, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Verde";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(30, 122);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(35, 13);
            this.label3.TabIndex = 3;
            this.label3.Text = "Azul";
            // 
            // comboBox1
            // 
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new System.Drawing.Point(105, 43);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(121, 21);
            this.comboBox1.TabIndex = 4;
            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
 
            // 
            // comboBox2
            // 
            this.comboBox2.FormattingEnabled = true;
            this.comboBox2.Location = new System.Drawing.Point(105, 85);
            this.comboBox2.Name = "comboBox2";
            this.comboBox2.Size = new System.Drawing.Size(121, 21);
            this.comboBox2.TabIndex = 5;
            // 
            // comboBox3
            // 
            this.comboBox3.FormattingEnabled = true;
            this.comboBox3.Location = new System.Drawing.Point(105, 122);
            this.comboBox3.Name = "comboBox3";
            this.comboBox3.Size = new System.Drawing.Size(121, 21);
            this.comboBox3.TabIndex = 6;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(292, 273);
            this.Controls.Add(this.comboBox3);
            this.Controls.Add(this.comboBox2);
            this.Controls.Add(this.comboBox1);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.button1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.ComboBox comboBox1;
        private System.Windows.Forms.ComboBox comboBox2;
        private System.Windows.Forms.ComboBox comboBox3;
    }
}

2º ARCHIVO

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
           Text = comboBox1.Text;
 
        }
        private void Form1_load(object sender, EventArgs e)
        {
            for (int f = 0; f < 255; f++)
            {
                comboBox1.Items.Add(f.ToString());
                comboBox2.Items.Add(f.ToString());
                comboBox3.Items.Add(f.ToString());
            }
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int rojo = int.Parse(comboBox1.Text);
            int verde = int.Parse(comboBox2.Text);
            int azul = int.Parse(comboBox3.Text);
            BackColor = Color.FromArgb(rojo, verde, azul);
        }
    }
}

3º ARCHIVO (YA PARA QUE EJECUTE SOLAMENTE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
 
namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}
He probado el ejemplo 1 y 2 y nada y yo desespero porque no controlo aun lo suficiente e intentado de otras menras sin cambiar eso y nada
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Wilfredo Patricio Castillo
Val: 707
Oro
Ha mantenido su posición en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Wilfredo Patricio Castillo (416 intervenciones) el 09/08/2016 18:24:52
No dices que es lo que realmente quieres, ya que todo lo que estás mostrando son las tripas de un formulario, si explicaras que pretendes te podríamos ayudar, además el tutorial que mencionas, lo único que hace es agregar un formulario y un par de controles.

Saludos cordiales,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 30
Ha disminuido su posición en 9 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Flash (21 intervenciones) el 12/08/2016 17:00:04
En el ejercicio 2 dice que devo añadir rojo verde azul y luego del porcentaje de eso que se añada al fondo
backcolor
y no me sale
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 22
Ha disminuido 1 puesto en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Thanatos (14 intervenciones) el 10/08/2016 16:13:38
El código que publicaste funciona, aunque no se muestran los elementos de los comboboxes, porque el método Form1_Load no está asociado al evento Load (que ocurre cuando el form se hace visible por primera vez). Como el método no llega a ejecutarse, no se cargan los items de los comboboxes.

Si estás utilizando Visual Studio, puedes asociar el evento y el método desde la vista de diseño.

También puedes hacerlo mediante código, luego de la inicialización de los componentes, en el constructor de la clase Form1:

1
2
3
4
5
public Form1()
{
    InitializeComponent();
    this.Load += new System.EventHandler(this.Form1_Load);
}


Captura
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil
Val: 30
Ha disminuido su posición en 9 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Flash (21 intervenciones) el 12/08/2016 17:26:21
Siento ser un poco pesado pero no funciona, ahora al menos me sale toda la lista hasta 255 que es el limite pero no camabia el backcolor he probado paso a paso pero se queda en el for
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 30
Ha disminuido su posición en 9 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Flash (21 intervenciones) el 12/08/2016 18:48:37
Funciona ahora no se que he tocado pero funciona lo unico que al actualizar no se actualiza sino que tengo que clickear el fondo
¿eso a que se debe? si se lo he añadido al Click que es parte del boton 1 (lo que faltaba para funcionar)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 30
Ha disminuido su posición en 9 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Flash (21 intervenciones) el 12/08/2016 21:18:04
Una ultima cosa (espero ser firme en mis palabras pero esto le he dado vueltas pero no se que signfica esto que hace

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
1º ARCHIVO
 
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
private System.ComponentModel.IContainer components = null; crea un contenedor sin nada dentro,
pero el resto no tengo ni idea para que es y si con el punto coge sus propiedadeso algo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 356
Plata
Ha disminuido 1 puesto en C sharp (en relación al último mes)
Gráfica de C sharp

Tutorial incompleto?

Publicado por Miguel (160 intervenciones) el 13/08/2016 03:26:36
El evento "Click" lo tienes que relacionar con el button1, no con el formulario (this).

1
button1.Click+= new System.EventHandler(button1_Click);
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar