473,410 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

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 1992

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
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
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
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
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
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
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
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
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
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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...
0
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
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...

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.