Soy nueva en ASP.NEt estoy realizando unas gráficas que ya me salen cuando declaro mis columnas a mano por ejemplo:
Dim Col1 As DataColumn = New DataColumn("Propuesta1", Type.GetType("System.Double"))
Dim Col2 As DataColumn = New DataColumn("Propuesta2", Type.GetType("System.Double"))
Dim Col3 As DataColumn = New DataColumn("Propuesta3", Type.GetType("System.Double"))
Dim Col4 As DataColumn = New DataColumn("Propuesta4", Type.GetType("System.Double"))
Dim Col5 As DataColumn = New DataColumn("Propuesta5", Type.GetType("System.Double"))
pero yo quiero declararlas dinámicamente ya que eso depende de una variable "x" que traigo de otro lado, quiero realizarlo de la siguiente manera pero no me sale:
Dim x As Integer
Dim i As Integer
Dim ColumnaP() As DataColumn
x=5
For i = 1 To x
ColumnaP(i) = New DataColumn("Propuesta" & i, Type.GetType("System.Double"))
Next
Me marca el siguiente error:
***** empieza el mensaje de error ********
"Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 139: For i = 1 To n
Line 140: ColumnaP(i) = New DataColumn("Propuesta" & i, Type.GetType("System.Double"))
Line 141: Next
Line 142:
***** aquí termina el mensaje de error ******
podrían ayudarme porfa.
mil gracias de antemano



