473,507 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use Deserialized output?

Obviously a newbie to vb.net and attempting to read an arraylist and then
use. No problem outputting and Serializing but, and the dumb question - how
to I extract something from the obj retrieved below (which debug shows has
values for the Person structure) and place in a text box?

Appreciate, Ed

<Serializable()> Public Structure Person
Dim Name As String
Dim Age As Integer
Dim Income As Decimal
End Structure

Public Sub btnReadArray_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReadArray.Click
Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As New ArrayList
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
obj = CType(BinFormatter.Deserialize(FS), ArrayList)
Nov 21 '05 #1
3 1995

Jan. 10, 2005

Try:

Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As ArrayList ' Change from As New to As
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
Persons = CType(BinFormatter.Deserialize(FS), ArrayList) 'Change to
Persons
for each obj in persons
P = Ctype(obj, person)
textbox1.text = P.Name
next

Then change the specific use of each Person object to match your
needs. I didn't test this, but it looks like it should work! :)
Joseph MCAD

"Ed Bitzer" wrote:
Obviously a newbie to vb.net and attempting to read an arraylist and then
use. No problem outputting and Serializing but, and the dumb question - how
to I extract something from the obj retrieved below (which debug shows has
values for the Person structure) and place in a text box?

Appreciate, Ed

<Serializable()> Public Structure Person
Dim Name As String
Dim Age As Integer
Dim Income As Decimal
End Structure

Public Sub btnReadArray_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReadArray.Click
Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As New ArrayList
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
obj = CType(BinFormatter.Deserialize(FS), ArrayList)

Nov 21 '05 #2

Jan. 10, 2005

Try:

Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As ArrayList ' Change from As New to As
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
Persons = CType(BinFormatter.Deserialize(FS), ArrayList) 'Change to
Persons
for each obj in persons
P = Ctype(obj, person)
textbox1.text = P.Name
next

Then change the specific use of each Person object to match your
needs. I didn't test this, but it looks like it should work! :)
Joseph MCAD

"Ed Bitzer" wrote:
Obviously a newbie to vb.net and attempting to read an arraylist and then
use. No problem outputting and Serializing but, and the dumb question - how
to I extract something from the obj retrieved below (which debug shows has
values for the Person structure) and place in a text box?

Appreciate, Ed

<Serializable()> Public Structure Person
Dim Name As String
Dim Age As Integer
Dim Income As Decimal
End Structure

Public Sub btnReadArray_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReadArray.Click
Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As New ArrayList
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
obj = CType(BinFormatter.Deserialize(FS), ArrayList)

Nov 21 '05 #3
I thank you Joseph, got it working.. I use to program in Pascal and was
use to creating custom types such as name, age, income but here it is
obvious I am just learning. I find that I can reference the individual
items in the array once "reconstituted" using TextBox1.Text =
Persons(0).Name and Person(2). age. I suspect the simpler way might have
been to use a multidimensional array.

Ed

"Joseph MCAD" <Jo********@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...

Jan. 10, 2005

Try:

Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As ArrayList ' Change from As New to As
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
Persons = CType(BinFormatter.Deserialize(FS), ArrayList) 'Change to
Persons
for each obj in persons
P = Ctype(obj, person)
textbox1.text = P.Name
next

Then change the specific use of each Person object to match your
needs. I didn't test this, but it looks like it should work! :)
Joseph MCAD

"Ed Bitzer" wrote:
Obviously a newbie to vb.net and attempting to read an arraylist and then
use. No problem outputting and Serializing but, and the dumb question -
how
to I extract something from the obj retrieved below (which debug shows
has
values for the Person structure) and place in a text box?

Appreciate, Ed

<Serializable()> Public Structure Person
Dim Name As String
Dim Age As Integer
Dim Income As Decimal
End Structure

Public Sub btnReadArray_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReadArray.Click
Dim FS As New System.IO.FileStream("c\test.txt",
IO.FileMode.OpenOrCreate)
Dim obj As Object
Dim Persons As New ArrayList
Dim P As Person
Dim BinFormatter As New Binary.BinaryFormatter
obj = CType(BinFormatter.Deserialize(FS), ArrayList)

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8120
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
3
2770
by: edgekaos | last post by:
Is method 2 valid? Method 1: wstring input = L"STRING"; wstring output = input; transform(output.begin(), output.end(), output.begin(), towupper); Method 2: wstring input = L"STRING";...
0
1050
by: Don | last post by:
I have deserialized XML back into an object, so now... How do I get the object instance back into a dataset? The same XML file(before deserializing) can be put into the dataset when read as a...
0
2050
by: newbie | last post by:
i'm a newbie of c language. can anyone help me to implement the code so that I can get the ciphertext from the output. thanks. #ifndef _3DES_H #define _3DES_H #ifndef uint8 #define uint8 ...
0
246
by: news.microsoft.com | last post by:
Hi! I have developed both a Web Service and a client application, and they works fine. All classes used in the Web Service interface are declared in an assembly named Entities, that is...
2
2057
by: =?Utf-8?B?RmFicmljaW8gRmVycmVpcmE=?= | last post by:
Hi, I'm facing an odd problem when consuming some web services in .Net. After call a web method, the response SOAP envelope isn't being deserialized properly. In fact, all href tags are not...
1
7851
by: vanajasethu | last post by:
Hi all, I am working in dotnet remoting using dotnet framework 2.0 in windows xp. I am hosting the remote object in iis using http channel and binary formatter and registering the object in...
6
1199
by: Monty | last post by:
Hello, I have a singleton settings class (.Net 2.0 framework) that I serialize/deserialize to XML. On my settings class is a shared list of integers. If I have two numbers in my list and I...
2
3358
by: gabosom | last post by:
Hi! I've been breaking my head trying to get the output variables from my Stored Procedure. This is my SP code CREATE PROCEDURE GetKitchenOrderDetail( @idService int, --outPut Variables ...
4
3550
by: roynevo | last post by:
Hi, I'm trying to deserialize an object on the context of a remoting call (RPC). The deserialization seem to work fine, however when I'm casting the result to the relevant class I get an...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.