C/Visual C - Este código no va (y tengo que enseñarselo al profesor)

 
Vista:
Imágen de perfil de emile

Este código no va (y tengo que enseñarselo al profesor)

Publicado por emile (1 intervención) el 25/12/2013 18:37:43
Pues nada llevo todo el fin de semana trabajando con "hundir la flota en c sharp" (usando el visual studio) y cuando despues de horas consigo depurar un error me sale otro contratiempo, y no consigo terminarlo.

"El método debe tener un tipo de valor devuelto",
me dice el programa refiriendose a la linea 67
(supongo que está quejándose de "public Form1()",
pero no sé que qué tengo que escribir en esa línea
para que deje de quejarse).

Solicito vuestra opinion para ver lo que le pasa.
Este es el código:

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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace BatallaNaval
{
    /// <summary>
    /// Description résumée de Form1.
    /// </summary>
 
    public
    class Program
    {
        private System.Windows.Forms.PictureBox[,] tab;
        private System.Windows.Forms.PictureBox pbox_test;
 
        /// <summary>
        /// Variable nécessaire au concepteur.
        /// </summary>
 
        private System.ComponentModel.Container components =
        null;
 
        public Form1()
        {
            //
            // Requis pour la prise en charge du Concepteur Windows Forms
            //
            InitializeComponent();
            //
            // TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
            //
        }
        /// <summary>
        /// Nettoyage des ressources utilisées.
        /// </summary>
 
        protected
        override
        void Dispose(
        bool disposing)
        {
            if (disposing)
            {
                if (components !=
                null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }
        #region Code généré par le Concepteur Windows Form
 
        /// <summary>
        /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
        /// le contenu de cette méthode avec l'éditeur de code.
        /// </summary>
 
        private
        void InitializeComponent()
        {
            System.Resources.ResourceManager resources =
            new System.Resources.ResourceManager(
            typeof(Form1));
 
            this.pbox_test =
            new System.Windows.Forms.PictureBox();
 
            this.SuspendLayout();
            //
            // pbox_test
            //
            this.pbox_test.BackColor = System.Drawing.Color.Red;
 
            this.pbox_test.Location =
            new System.Drawing.Point(712, 16);
 
            this.pbox_test.Name = "pbox_test";
 
            this.pbox_test.Size =
            new System.Drawing.Size(32, 24);
 
            this.pbox_test.TabIndex = 0;
 
            this.pbox_test.TabStop =
            false;
 
            this.pbox_test.DoubleClick +=
            new System.EventHandler(
            this.pbox_test_DoubleClick);
            //
            // Form1
            //
            this.AutoScaleBaseSize =
            new System.Drawing.Size(5, 13);
 
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
 
            this.ClientSize =
            new System.Drawing.Size(760, 494);
 
            this.Controls.Add(
            this.pbox_test);
 
            this.Cursor = System.Windows.Forms.Cursors.Default;
 
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
 
            this.MaximizeBox =
            false;
 
            this.Name = "Form1";
 
            this.Text = "Form1";
 
            this.Load +=
            new System.EventHandler(
            this.Form1_Load);
 
            this.ResumeLayout(
            false);
        }
        #endregion
 
        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
 
        [STAThread]
 
        static
        void Main()
        {
            Form1 appli =
            new Form1();
 
            Application.Run(appli);
        }
 
        private
        void Form1_Load(
        object sender, System.EventArgs e)
        {
            //Création du tableau de picture Box
 
            this.tab =
            new System.Windows.Forms.PictureBox[9, 9];
 
            for (
            int j = 0; j < 8; j++)
            {
                int i;
                for (i = 0; i < 9; i++)
                {
                    this.tab[i, j] =
                    new PictureBox();
 
                    this.tab[i, j].Size =
                    new System.Drawing.Size(40, 40);
 
                    this.tab[i, j].Location =
                    new System.Drawing.Point(i * 50 + 125, j * 50 + 70);
 
                    this.tab[i, j].Name = "tab[" + i + "," + j + "]";
 
                    this.tab[i, j].TabIndex = 0;
 
                    this.tab[i, j].BackColor = System.Drawing.Color.Green;
 
                    this.tab[i, j].Click +=
                    new System.EventHandler(
                    this.cmdTab_Click);
 
                    this.Controls.Add(
                    this.tab[i, j]);
                }
                i = 0;
            }
        }
        private
        void pbox_test_DoubleClick(
        object sender, System.EventArgs e)
        {
            pbox_test.BackColor = Color.Blue;
 
            tab[2, 1].BackColor = Color.Blue;
        }
 
        private
        void cmdTab_Click(
        object sender, System.EventArgs e)
        {
            pbox_test.BackColor = Color.Cyan;
            PictureBox PB = (PictureBox)sender;
            PB.BackColor = Color.Cyan;
        }
    }
}
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