Ver Mensaje Individual
  #8 (permalink)  
Antiguo 30/11/2009, 07:34
Avatar de gnzsoloyo
gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 6 meses
Puntos: 2658
Respuesta: Ayuda con programa que muestre informacion del pC

Cita:
Iniciado por carlitta Ver Mensaje
el error que siempre sale es
"se esperaba fin de declaracion!
saludos
Trata de ser un poco más detallada en la explicación: En qué líneas (ejemplos), en cuáles métodos, qué partes del código no reconoce. qué cosas hiciste para tratar de resolverlo, qué cosas o mensajes no entiendes.
¿Importaste el workspace System.Management?
¿Trataste de ver por qué no reconocía las declaraciones de variables o métodos?
¿La copia de código generó algún error?

Por las dudas, te pongo el código tal y como yo lo copié (es el mismo salvo el nombre de la clase):
Código VB.Net:
Ver original
  1. Public Class SystemDescription
  2.  
  3. #Region "Variables"
  4.     Private _strComputerName As String
  5.     Private _strManufacturer As String
  6.     Private _StrModel As String
  7.     Private _strOSName As String
  8.     Private _strOSVersion As String
  9.     Private _strSystemType As String
  10.     Private _strTPM As String
  11.     Private _strWindowsDir As String
  12.     Private _decVelocidadProcesador As Decimal
  13. #End Region
  14.  
  15. #Region "Propiedades"
  16.     Public ReadOnly Property pr_ComputerName() As String
  17.         Get
  18.             Return _strComputerName
  19.         End Get
  20.     End Property
  21.     Public ReadOnly Property pr_Manufacturer() As String
  22.         Get
  23.             Return _strManufacturer
  24.         End Get
  25.     End Property
  26.     Public ReadOnly Property pr_Model() As String
  27.         Get
  28.             Return _StrModel
  29.         End Get
  30.     End Property
  31.     Public ReadOnly Property pr_OsName() As String
  32.         Get
  33.             Return _strOSName
  34.         End Get
  35.     End Property
  36.     Public ReadOnly Property pr_OSVersion() As String
  37.         Get
  38.             Return _strOSVersion
  39.         End Get
  40.     End Property
  41.     Public ReadOnly Property pr_SystemType() As String
  42.         Get
  43.             Return _strSystemType
  44.         End Get
  45.     End Property
  46.     Public ReadOnly Property pr_TotalPhysicalMemory() As String
  47.         Get
  48.             Return _strTPM
  49.         End Get
  50.     End Property
  51.     Public ReadOnly Property pr_WindowsDirectory() As String
  52.         Get
  53.             Return _strWindowsDir
  54.         End Get
  55.     End Property
  56.     Public ReadOnly Property pr_VelocidadProcesador() As Decimal
  57.         Get
  58.             Return _decVelocidadProcesador
  59.         End Get
  60.     End Property
  61. #End Region
  62.  
  63. #Region "Constructor"
  64.     Public Sub New()
  65.         Dim objMgmt As New Management.ManagementObject
  66.         Dim objMOS As Management.ManagementObjectSearcher
  67.         objMOS = New Management.ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")
  68.         For Each objMgmt In objMOS.Get
  69.             _strOSName = objMgmt("name").ToString.Trim
  70.             _strOSVersion = objMgmt("version").ToString.Trim
  71.             _strComputerName = objMgmt("csname").ToString.Trim
  72.             _strWindowsDir = objMgmt("windowsdirectory").ToString.Trim
  73.         Next
  74.         objMOS = New Management.ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem")
  75.         For Each objMgmt In objMOS.Get
  76.             _strManufacturer = objMgmt("manufacturer").ToString.Trim
  77.             _StrModel = objMgmt("model").ToString.Trim
  78.             _strSystemType = objMgmt("systemtype").ToString.Trim
  79.             _strTPM = objMgmt("totalphysicalmemory").ToString.Trim
  80.         Next
  81.         objMOS = New Management.ManagementObjectSearcher("SELECT * FROM Win32_Processor")
  82.         For Each objMgmt In objMOS.Get
  83.             _decVelocidadProcesador = CDec(objMgmt("CurrentClockSpeed").ToString.Trim)
  84.         Next
  85.         objMOS.Dispose()
  86.         objMOS = Nothing
  87.         objMgmt.Dispose()
  88.         objMgmt = Nothing
  89.     End Sub
  90. #End Region
  91.  
  92. End Class
Al menos a mí me funcionó, aunque tuve que corregir muchos problemas de sintaxis por el Copy+Paste...
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)