C sharp - No se puede encontrar el tipo o el nombre de espacio de nombres "DataGridView"

 
Vista:

No se puede encontrar el tipo o el nombre de espacio de nombres "DataGridView"

Publicado por mario (3 intervenciones) el 16/12/2013 15:32:24
No se puede encontrar el tipo o el nombre de espacio de nombres 'DataGridView' (¿falta una directiva using o una referencia de ensamblado


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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
 
namespace ConsoleApplication21
{
    class Matriz
    {
        int[,] mat;
        int ren = 0;
        int col = 0;
 
        public Matriz() { }
        public Matriz(int r, int c)
        {
            ren = r;
            col = c;
            mat = new int[r, c];
        }
        public Matriz(DataGridView dgv)
        {
            try
            {
                ren = dgv.RowCount;
                col = dgv.ColumnCount;
 
                mat = new int[ren, col];
                for (int r = 0; r < dgv.RowCount; r++)
                    for (int c = 0; c < dgv.ColumnCount; c++)
                        mat[r, c] = Convert.ToInt32(dgv.Rows[r].Cells[c].Value.ToString());
            }
            catch
            {
            }
        }
 
        public int this[int ren, int col]
        {
            get { return mat[ren, col]; }
            set { mat[ren, col] = value; }
        }
        public double promDP()
        {
            double suma = 0;
            if (ren == col)
            {
                for (int i = 0; i < mat.GetLength(0); i++)
                    suma += mat[i, i];
            }
            return suma / mat.GetLength(0);
        }
        public double promDI()
        {
            int c = 0;
            double suma = 0;
            if (ren == col)
            {
 
                for (int r = ren - 1; r >= 0; r--)
                {
                    suma += mat[r, c];
                    c++;
                }
            }
            return suma / mat.GetLength(0);
        }
 
        static public Matriz operator *(Matriz a, Matriz b)
        {
            Matriz aux = new Matriz(a.ren, a.col);
            if (a.col == b.ren && a.ren == b.col)
            {
 
                for (int r = 0; r < a.ren; r++)
                    for (int c = 0; c < a.col; c++)
                    {
                        aux[r, c] = 0;
                        for (int k = 0; k < aux.ren; k++)
                            aux[r, c] = aux[r, c] + a[r, k] * b[k, c];
                    }
            }
            return aux;
        }
        static public Matriz operator +(Matriz a, Matriz b)
        {
            Matriz aux = new Matriz(a.ren, a.col);
            if (a.ren == b.ren && a.col == b.col)
            {
 
                for (int r = 0; r < a.ren; r++)
                    for (int c = 0; c < a.col; c++)
                    {
                        aux[r, c] = 0;
                        aux[r, c] = a[r, c] + b[r, c];
                    }
            }
            return aux;
        }
        static public Matriz operator -(Matriz a, Matriz b)
        {
            Matriz aux = new Matriz(a.ren, a.col);
            if (a.ren == b.ren && a.col == b.col)
            {
 
                for (int r = 0; r < a.ren; r++)
                    for (int c = 0; c < a.col; c++)
                    {
                        aux[r, c] = 0;
                        aux[r, c] = a[r, c] - b[r, c];
                    }
            }
            return aux;
        }
 
    }
}
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

No se puede encontrar el tipo o el nombre de espacio de nombres "DataGridView"

Publicado por Fernando (31 intervenciones) el 17/01/2014 22:34:17
Te falta el espacio de nombres

using System.Data;

Por favor indica si te sirvió la respuesta
saludos
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

No se puede encontrar el tipo o el nombre de espacio de nombres "DataGridView"

Publicado por Juan Manuel Castañeda (71 intervenciones) el 27/01/2014 00:49:34
using System.Windows.Forms
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