Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Array globale
martedì 13 febbraio 2007 - 09.59
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
sasa72
Profilo
| Newbie
23
messaggi | Data Invio:
mar 13 feb 2007 - 09:59
Ciao,
qualcuno sa spiegarmi come faccio a definire una array globale in vb.net ?
se è di un tipo come ad esempio byte faccio cosi
Private Shared gCommand_ID As Byte
Public Shared Property Command_ID() As Byte
Get
Return gCommand_ID
End Get
Set(ByVal Value As Byte)
gCommand_ID = Value
End Set
End Property
ma se deve restituirmi un array di byte come si fa?
Vi prego aiutatemi non riesco a trovare alternative..
Grazie
Giamp72
Profilo
| Junior Member
115
messaggi | Data Invio:
mar 13 feb 2007 - 11:13
non è chiarissimo ciò che chiedi... ma provo a risponderti ugualmente..
Questo è il codice che ti serve?
Private Shared gCommand_ID() As Byte
Public Shared Property Command_ID() As Byte()
Get
Return gCommand_ID
End Get
Set(ByVal Value() As Byte)
gCommand_ID = Value
End Set
End Property
Giamp72
sasa72
Profilo
| Newbie
23
messaggi | Data Invio:
mar 13 feb 2007 - 12:04
cerco di spiegarmi meglio
finchè devo definire una variabile di tipo string globale il seguente codice funziona
Private Shared gCommand_Timeout As String
Public Shared Property Command_Timeout() As String
Get
Return gCommand_Timeout
End Get
Set(ByVal Value As String)
gCommand_Timeout = Value
End Set
End Property
ma ho bisogno di definire un array globale e se faccio cosi come hai detto tu che avevo già provato
quando vado ad assegnare il valore ad esempio
Me.gCommand_Len(0) = &H0
mi dà l'errore
An unhandled exception of type 'System.NullReferenceException' occurred in RS232.exe
Additional information: Object reference not set to an instance of an object.
Forse sbaglio nella set e get della proprietà?
Giamp72
Profilo
| Junior Member
115
messaggi | Data Invio:
mar 13 feb 2007 - 12:24
ma se + semplicemente dichiari nella tua classe
Public gCommand_ID() As Byte
potrai scrivere e leggere i valori attraverso la tua classe...
classe.gcommand(1)=1
num=classe.gcommand(2)
potrebbe andare?
Giamp72
sasa72
Profilo
| Newbie
23
messaggi | Data Invio:
mar 13 feb 2007 - 14:14
mi dà lo stesso errore di prima quando arriva all'assegnazione!
Giamp72
Profilo
| Junior Member
115
messaggi | Data Invio:
mar 13 feb 2007 - 16:15
ma hai tolto
Public Shared Property Command_Timeout() As String
e tutto il suo contenuto????
Giamp72
sasa72
Profilo
| Newbie
23
messaggi | Data Invio:
mar 13 feb 2007 - 16:45
si che l'ho tolto!!
Giamp72
Profilo
| Junior Member
115
messaggi | Data Invio:
mar 13 feb 2007 - 17:26
mi sembra molto strano perchè a me questo codice funziona benissimo.. te lo allego...
fammi sapere.
Giamp72
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !