Click here to Skip to main content
15,916,188 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Loop Question Pin
Jim Matthews15-Mar-05 8:30
Jim Matthews15-Mar-05 8:30 
GeneralRe: Loop Question Pin
Makniteasy15-Mar-05 8:42
Makniteasy15-Mar-05 8:42 
GeneralRe: Loop Question Pin
Jim Matthews15-Mar-05 9:09
Jim Matthews15-Mar-05 9:09 
GeneralRe: Loop Question Pin
Dave Kreskowiak15-Mar-05 9:11
mveDave Kreskowiak15-Mar-05 9:11 
GeneralRe: Loop Question Pin
Makniteasy17-Mar-05 7:15
Makniteasy17-Mar-05 7:15 
GeneralHTA and IsConnectible Ping Pin
pn199515-Mar-05 3:32
pn199515-Mar-05 3:32 
GeneralRe: HTA and IsConnectible Ping Pin
Dave Kreskowiak15-Mar-05 6:22
mveDave Kreskowiak15-Mar-05 6:22 
Generalneed help: deserialise Pin
Dahoolio15-Mar-05 3:14
Dahoolio15-Mar-05 3:14 
Can someone PLEASE look at the following code??


<code>
<Serializable()> _
Public Class SerialDataPack

Public Shared PLCname As String '-- PLC Station name
Public Shared Reason As Reasons '-- Enumerate of reason to send
Public Shared File() As Byte '-- File as bytearray

Enum Reasons
[STARTUP]
[EVENT]
[REQ]
[GENREQ]
End Enum

End Class</code>


i serialize the object, send it to the other client and do the following code:


<code>Dim filepath As String = "c:\PLC\Listener\Received\Temp " & EventCounter & ".bin"
'-- write this file to HDD location filepath;
Dim BW As New BinaryWriter(File.OpenWrite(filepath))
BW.Write(Buffer, 0, numbytes)
BW.Close()

'-- then read it back with binaryformatter
Dim bf As BinaryFormatter = New BinaryFormatter
Dim fs = New FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim SocketListenerSDRecv As SerialData.SerialDataPack
'-- similair to CType but faster runtime according to MSDN
SocketListenerSDRecv = DirectCast(bf.Deserialize(fs), SerialData.SerialDataPack)
fs.Close()</code>


when i DESERIALIZE the fs i get the folowing error (and CType spawns same error);

"The given conversion is invalid"


does someone has a suggestion, maybe i should re-implement my serializable class?????




If you make something idiotproof, someone else will make a better idiot.....
GeneralRe: need help: deserialise Pin
Dave Kreskowiak15-Mar-05 6:17
mveDave Kreskowiak15-Mar-05 6:17 
GeneralRe: need help: deserialise Pin
Dahoolio16-Mar-05 20:17
Dahoolio16-Mar-05 20:17 
GeneralRe: need help: deserialise Pin
Dahoolio15-Mar-05 20:40
Dahoolio15-Mar-05 20:40 
QuestionHOW TO: populate Menus at runtime Pin
azam31614-Mar-05 19:39
azam31614-Mar-05 19:39 
AnswerRe: HOW TO: populate Menus at runtime Pin
rwestgraham14-Mar-05 21:38
rwestgraham14-Mar-05 21:38 
GeneralHide Tabpage Pin
Mohamed Ishak14-Mar-05 19:27
professionalMohamed Ishak14-Mar-05 19:27 
GeneralRe: Hide Tabpage Pin
rwestgraham14-Mar-05 21:04
rwestgraham14-Mar-05 21:04 
GeneralRe: Hide Tabpage Pin
Mohamed Ishak15-Mar-05 2:59
professionalMohamed Ishak15-Mar-05 2:59 
GeneralDetecting CD drive media change Pin
thebox211214-Mar-05 17:16
thebox211214-Mar-05 17:16 
GeneralRe: Detecting CD drive media change Pin
thebox211214-Mar-05 17:52
thebox211214-Mar-05 17:52 
GeneralRe: Detecting CD drive media change Pin
Dr_Lomax16-Mar-05 14:38
Dr_Lomax16-Mar-05 14:38 
GeneralRe: Detecting CD drive media change Pin
Dr_Lomax16-Mar-05 14:42
Dr_Lomax16-Mar-05 14:42 
GeneralVB and Matlab Pin
Anonymous14-Mar-05 17:10
Anonymous14-Mar-05 17:10 
QuestionValidating ? Pin
Progzz14-Mar-05 16:16
Progzz14-Mar-05 16:16 
AnswerRe: Validating ? Pin
Christian Graus14-Mar-05 16:45
protectorChristian Graus14-Mar-05 16:45 
GeneralRe: Validating ? Pin
Progzz14-Mar-05 16:48
Progzz14-Mar-05 16:48 
GeneralRe: Validating ? Pin
Christian Graus14-Mar-05 17:00
protectorChristian Graus14-Mar-05 17:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.