Passing Serializable Objects Through Sockets?

Jul 16, 2009

I have no idea where to begin. I've looked online but haven't been able to find anything.

View 1 Replies


ADVERTISEMENT

Passing Objects Between Forms?

Aug 11, 2010

I'm translating a document management application from vb6. I want to program with good habits and technique, so I'm asking for your opinion really rather than just a solution.I have a decent understanding of OOP, but I'm not very experienced in VB at all. What I'm doing now is trying to figure out the best way to pass objects between forms.For example, in my initialization form, I have an object that stores a group of database connections. I need to pass this object around because reconnecting takes a significant amount of time. There are other objects such as user info and permissions.

Public Class Form 1
Dim DB = New DBobject
Public Sub Form1_Load

[code]......

View 5 Replies

Passing Objects Between WCFs?

May 20, 2011

I have an ASP application, which calls an HTTP WCF service, which calls a TCP WCF service (all on different servers). I'm ultimately trying to pass one class object between the three.I've discovered that I can't do this directly in the HTTP WCF, even though my class object is defined identically in BOTH WCFs. Like this:

Public Function CallOtherFunction(ByVal ThisClass as MyClass)
Dim RetVal as Boolean
RetVal = CallMyOtherWCFFunction(ThisClass)
End Function

Instead I have to:

Public Function CallOtherFunction(ByVal ThisClass as MyClass)
Dim RetVal as Boolean
Dim MyOutgoingClass as MyOtherWCF.MyClass

[code]....

My objects are rather large, to say they have a lot of properties. Any way to not have to declare a new variable in my calling function?

View 1 Replies

Passing Objects To Methods?

Jun 26, 2010

I always thought I understood how this works...but lately I have started really using interfaces and now things arent doing what I am expecting.

using entity framework, I have a service for each object that is responsible for interacting with the database and such....on my one service I am passing the collection of objects to my service as an icollection(of contactinfo) before I pass the object, the changetraker has the right states. however in my method, this is not the case and all states are set to unmodified.

Private Sub SaveExecute(ByVal param As Object)
Dim srv As Services.ContactInfoService = GetService(Of Services.IContactInfoService)()

[Code]....

As I said above the Me.contacInfoCollection has the right changetracking states. But Once its passed to the srv.savechanges it reverts to unmodified. I am sure its something silly I am missing...the whole EF thing can be confusing to me...

View 2 Replies

C# - Passing Objects Into Constructor Before Initialized?

Jun 12, 2011

I have the following problem. This is a simple example of some classes I have (each have dependencies on other classes).

public Class1()
{
public Class1(Class2 class2)[code].....

The problem I have is that the assert is always null, even though class1 has been initalized. One condition I do have is that I only want there to be one instance of each class created.

View 3 Replies

Passing An Arraylist Of Objects From One Class To Another?

Aug 19, 2011

I have the following code in Class B

FolderList.add(FolderCategory)

when i do a count it display a list of 25 items in the folderlist.Now i have a main class when i tried to use the following method

Dim MainClass as New ClassB

Console.writeline(MainClass.FolderList.count()) the value reflects as 0 items meaning is empty.i need to retrieve the arraylist from Class B using the MainClass to retrieve those items inside the arraylist.

View 7 Replies

VS 2010 Passing Objects And Sessions?

Aug 21, 2011

I was wondering if someone could tell me if this is "bad practice" or is a perfectly acceptable way to pass an object to another form.I've cut out a lot of the code to summarise what im asking.

[Code]...

Dim myRetrievedObject as myObject = Module1.returnSavedObject()Is this a acceptable way of passing an object between forms or is it a completely bad idea?Ideally i would like to be able to "add" further objects to the initially created object in Form1 but then on reloading of Form1 , retrieve the new version of myObject with the newly added objects within the myObject class.My initial thinking is this creates an almost session like state for the initial object. So you can use the same object over all 3 forms or more and just simply add to it like a shopping cart type of functionality.

View 10 Replies

C# - Preferred Techniques For Passing Objects Which Clients May Invalidate

Jan 31, 2012

I have adopted a technique where I pass existing objects to forms so that they can display the object's content and allow the user to alter it if necessary. The form is not bound to the object, so when it comes time to act, the form sweeps up the content of its controls and puts them into the object. The object is then validated and any issues reported to the user. If the object is valid, it may be handed back to the caller so the caller can refresh a view/list/etc.

So far, so good. However, if the form's content, or lack of, creates an invalid object and the user does not correct it, maybe cancelling the form, there's a chance the form will hand an invalid object back to the caller. This is not good.

Essentially I'm looking for an elegant and efficient way of either leaving the object as it was or rolling back if the user cancels the form/action.

I have considered a range of techniques, each with many pros and cons. I'm keen to consider some other views.

View 3 Replies

Call Method Base Class In Program Passing Sub Class Objects?

Apr 22, 2012

Base class has one field to hold numeric balance value. With 2 methods that accept arguments for adding and subtracting the new input calculating new balance. Sub class has four fields dates, transaction, memo and amount.I have a deposit form, and withdraw form. Each time one transaction is entered it creates an object with sub class fields, then adds to the account collection. My problem is not understanding how to call the deposit/withdraw method and pass the current transaction amount back to the base class to alculate the new balance. Does anyone have any links to information/tutorials on how to perform something like this? As you can see with my code I have tried various different approaches without any success.

[Code]...

View 5 Replies

Get MD5 Of Serializable Class

Feb 27, 2011

I have a class that is serializable. I would like to compute the MD5 of it. I already had a function in the project to get a MD5 from a Stream, so I reused it, and created a function to convert an object to a memorystream. The code is as follows. Does anyone see any problems, but more to the point, is there an easier way to do this that I'm simply missing?

[Code]...

View 2 Replies

Serializable Dictionary, How To Set Key Name

Jul 16, 2010

Question: I use a serializable dictionary class, found at , to serialize a dictionary.

View 6 Replies

Why Isn't .Net Object Serializable

Jun 2, 2010

I've got a 'MyDataTable' class that inherits from System.Data.DataTable I've implemented ISerializable in my class and have a 'Public Overrides Sub GetObjectData...' But when I try to serialize the an object of 'MyDataTable' I get an error saying that 'MyDataTable' is not marked as serializable.

[Code]...

View 2 Replies

C# - Serializable Partial Classes?

May 29, 2009

I have the follow VB.NET class definition:<Serializable()> Partial Public Class Customers End Class

Inside another file I have the same thing (with different methods and variables of course). When I compile, I get the following error:Attribute 'SerializableAttribute' cannot be applied multiple times.The error is pretty self explanatory. My question is though, if I just mark the one class as Serializable(), can I assume the entire class with be marked as serializable()? In other words, Do I only need the serializable() tag in 1 spot in the class?

View 2 Replies

Make Interface Serializable

Mar 22, 2012

Having to update somebody else's code. Did I do this correct for the code below?

[Code]...

View 2 Replies

Serializable Class Collections?

Apr 11, 2009

I have a class that contains a list of properties which serializes just fine. However I need one of those properties to contain a collection of another class to give me sub classes

Example XML
<VideoOptions>
<property1>value1</property1>

[code].....

View 2 Replies

Cannot Get Values From A Serializable Class And Structure

Feb 17, 2010

I have a serializable class and structure I created for an ArrayList to be access within a Web Application. The problem I am having is the count comes back as zero after calling New. I debugged the code and the Arrylist is being populated

View 3 Replies

Instead Of Marking A Class With The <Serializable()> Attribute?

Jul 10, 2011

ToSerializable is it possible instead of marking a Class with the <Serializable()> attribute?

as in the following Class.So you could maybe do:>>myObject.ToSerializable

<Serializable()> _Public Class ExampleClass
End Class

View 11 Replies

Serializable()> Attribute For A BO Class Which Is On App Server?

Dec 5, 2011

I have the following architecture for my project:UI -> Web Server -> App Server -> Database

I am using SOA architecture for my project. My Web Service is residing on AppServer having BL (Business Layer) / BO (Business Object) / DAL (Data Access Layer). I am exposing the BL using Web Service. I am getting the service reference to this Web Service at WebServer by creating the proxy using WSDL.exe. Now my question is:

[Code]...

View 2 Replies

What Class For Serializable Multidimensional Arrays

Feb 19, 2009

EDIT: SI have a web service which uses a class of functions in order to return data used in various business processes (via InfoPath). One of the functions takes a given SQLCommand object and executes it into a SQLDataReader. Now depending on the SQL command text used this may return one or many rows of one or many columns. So what is the best class for this function to return bearing in mind it needs to be serialized by the web service.

My existing code is:
Dim array As New ArrayList
Try

[code].....

View 1 Replies

Concurrency Control With Serializable Isolation Level?

Jun 28, 2011

I have to handle concurrency control and I used SqlClient.SqlTransaction with IsolationLevel.Serializable level. In that transaction, I do 3 works:

1. Select the latest updated time from a record of a table

2. Compare the latest updated time with a stored time paramater

3. If the result form comparision is "same" I will update that record

But my problem is, when 2 transactions is run at almost the same time.

[Code]...

View 4 Replies

Serialize An Object, Exception Because Form Is Not Serializable

Jul 28, 2010

I have a class called Truck and a form called frmTruck I have some code like this in a method. It recieves obj as Truck

Dim ms As New MemoryStream(1000)
Dim bf As New BinaryFormatter(Nothing, New StreamingContext(StreamingContextStates.Clone))
bf.Serialize(ms, obj)

To simplify my code, I have basically something like this for frmTruck:

public class frmTruck
private truckValue as Truck
public sub DoSomething()

[code]....

During the LoadTruckFromDatabase function I call the SerializeTruck method, here everything goes fine. But when I call the SerializeTruck just before End sub of DoSomething, it goes wrong I get an exception saying that frmTruck is not serializable My truckinstance doesn't have any references to frmTruck...

View 12 Replies

VS 2008 How To Have A Serializable Class Ignore A Property

Sep 11, 2009

How can i make one item in my class not serialize?

I have tried adding:

<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)> with no avail

View 2 Replies

.net - Can't Call Serialize() On Instance Of Serializable Singleton Class?

Nov 28, 2011

I have a VB.NET singleton class which implements Serializable:

Imports System.IO
Imports System.Runtime.Serialization

<Serializable()> Public Class CoordinateHistory[code].....

My problem is that I can't actually call .Serialize() on the instance of this class, like all of the examples online show. What am I doing wrong?

View 2 Replies

C# - Serialize A Class Containing An Object (of Any Serializable Type) To XML (Conditon: .NET 1.1)?

Sep 21, 2011

Question: I must get the content of all sessions in a HttpModule, under .NET 1.1. (don't ask my why certain people still use it) I can write the module, I can get the sessions. But... sessions are stored as

[Code]...

View 2 Replies

VS 2008 - Custom Control 'Serializable' - Contains A List(Of Panel)

Nov 29, 2010

I'm trying to create a custom control that contains a List(Of Panel). I quickly ran into an error about the base class Panel being nonserializable. So I created my own class that inherits from Panel and implemented the ISerializable interface. At the surface, everything appears to work, at least everything at design time. I don't know what would happen if I tried to run the application. Anyway, the errors occur when I try to open a file that contains my custom control. For example, I create a new Windows Form and add my custom control to it. I save the Form and close it.

Then I try to open the form and get the following error: Object of type 'MyTestApplication.SerializablePanel[]' cannot be converted to type 'MyTestApplication.SerializablePanel[]'.

I don't know what I'm doing wrong? I've opened the XML file to see what it's actually writing, and read the header notes about using binary base64 serialization. I think that's what I'm using, but I'm not sure.

Below is the code for the class SerializablePanel:

Imports System.Runtime.Serialization
Imports System.ComponentModel

<Serializable()> _

[CODE]...

View 5 Replies

Make A MVC 2 Json Serializable Structure With Apropriate PK Array Keys?

Jan 1, 2010

I have a table with a Int PK column and a name. I want to load them into an object of some sort and return them using Json() ActionResult in MVC 2. I am having a hard time finding a built-in structure that is supported for serialization that keeps a simple key/value structure in tact.

Ultimately I would like to do something like:
Function JsonList() As ActionResult
Dim Things = New Dictionary(Of Integer, String)

[code].....

View 1 Replies

Make Objects From The ToolBox Using Code Instead Of Changing Existing Objects Invisible Then Visible Later?

Dec 5, 2011

make objects from the ToolBox using code instead of changing existing objects invisible then visible later?

View 7 Replies

Sql - Error The SqlParameterCollection Only Accepts Non-null SqlParameter Type Objects, Not Int32 Objects?

Jun 23, 2012

I am getting this error, Not sure why it is happening "Error The SqlParameterCollection only accepts non-null SqlParameter type objects, not Int32 objects."I have tried with all sorts of possibilties, now try to enter default data as dummy data,

Using connection As New SqlConnection
connection.ConnectionString = ConfigurationManager.ConnectionStrings("DentalDeviceConnectionString").ConnectionString
connection.Open()[code].....

View 1 Replies

Modifying Objects Inside For Each Loop Sets Properties Of All Objects With Values Of Last One?

Jan 29, 2011

I have a program like this.

Module Module1

Public Class Mstr
Public Property Prop1 As String
Public Property Prop2 As String[code]....

But it is not working as I expect it to. You can see it from.The DtlsB properties of all three DtlsA objects are having values from last iteration.

View 1 Replies

Random Objects - Let The User Input Objects To A Richtextbox 1 Object On Each Line?

Jan 6, 2011

I want to let the user input objects to a richtextbox 1 object on each line, and somehow use Random.Next to select pseudorandomly a few objects, the number 'few' inputted in a textbox.

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved