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


ADVERTISEMENT

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

Getting Field Values From A List Into Fields In A Structure Or Class?

Mar 21, 2012

I have a class (using a class rather than a structure only because I can set a default field value for the fields I declare in the class) and I'm using a web service that returns information (demographic information) in JSON. I am using LINQ to get the values of each "entry" from the returned list and in that, I have to parse through and pull out the actual data that I want.Here's how I have it doing right now (just a start, there are 44 of them total, thus my question which will follow the code):

Dim returnedStats = From ljo As Linq.JObject In returnedObject.SelectToken("results")
'
'
For Each stat As Linq.JObject In returnedStats

[code]....

View 2 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 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

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

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

Class Structure - Large Structure That Has Lots Of Properties ?

Jan 5, 2010

I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.

Let's say I have a pretty large structure that has lots of properties.

Code:

Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)

Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.

Code:

Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?

In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.

View 11 Replies

VS 2008 Convert The XML Structure Into A Class Structure?

Apr 25, 2010

I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).

The XML document looks like this:

xml
<?xml version="1.0" encoding="utf-8"?>
<artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">

[code]....

View 2 Replies

Passing A Structure From One Class To Another Class In A Applications (VS2008)

Apr 7, 2010

I'm sure there are several ways of achieving my goal but I am after opinions on what you think is the best option. I'm writing a vb.net application which (amongst other thinks) interfaces with media players in the home. Because there are different types of media playersI'm trying to structure it so each type of media player has it's own class which interfaces to a management class which sits on top of all the different devices types.

The device classes are responsible for discovering the phsyical devices and returning that information up to the management class. A device class may be responsible for monitoring 1 or more physical devices so..

[Code]...

View 1 Replies

Asp.net - Structure A Class Inside A Class?

Jun 3, 2011

Currently, if I have different classes containing functions etc, I would structure them all in the 1 VB file titled whatever the main Class is. For example:

[Code]...

However, the problem with this is the file can become 1000s of lines long making hard to find portions of code. Is there a way I can store SubClass in a file such as MainClass.SubClass.vb so that its easier to locate classes? Or is there a better, more standard, way of doing this?

View 3 Replies

C# - Use A Structure Rather Than A Class?

Apr 10, 2009

In a recent project I was working I created a structure in my class to solve a problem I was having, as a colleague was looking over my shoulder he looked derisively at the structure and said "move it into a class". I didn't have any argument for not moving it into a class other than I only need it in this class but this kind of falls down because couldn't I make it a nested class?

View 5 Replies

Getting The Sum Of All Values For A Specific Structure Member?

Nov 23, 2009

In VB.NET, let's assume I have the following Structure:

Public Structure Product
Public ItemNo As Int32
Public Description As String[code].....

How would I define a LINQ Query to Sum all of the Product.Cost values in the List? In other words, what would be the LINQ Query in VB.NET to return the value 120.90, which reflects the sum of all three Product Cost values in a single LINQ Query?

View 2 Replies

.net - Where To Keep A Structure: Class, Module Or None

Apr 18, 2011

This is purely a coding practice question concerning VB.NET structures. Where do you keep one?As an example, I've created a structure for the simple purpose of keeping information organized, I'd like this structure to be stand-alone, not belonging to any class so I wouldn't have to access it through SomeClass.MyStructure but rather simply MyStructure. So, do I keep it in a separate class and import it into my namespace? Do I keep it in a module (Static class, essentially)? Do I just make a separate VB.NET code file and place is there (I would like it to live in a separate file). Just to clarify, I need this structure to be accesses by the whole application, not just a single class.

View 1 Replies

Class Structure For Three Outputs?

Feb 20, 2012

Could someone write me a Class structure for passing the data array below.

Function function1(Byval input1 as Double, Byval input2 as Double, Byval input3 as Double)
'code'
data.data1=value1

[code].....

View 4 Replies

Array Structure With Values For Each Data Type

Nov 8, 2011

I epochly failed creating an array structure. How would I build it like I tried to do with values for each data type.

Structure PovertyGuidelines
Dim Id As Decimal
Dim NumberOfPersons As Decimal
Dim AnnualIncome As Decimal
End Structure
Private Data(20) As PovertyGuidelines
Private Id(,) As Decimal = {{1D, 2D, 3D}}
Private NumberOfPersons(,) As Decimal = {{6D, 9D, 7D}}
Private AnnualIncome(,) As Decimal = {{24000D, 32000D, 27000D}}

View 1 Replies

Assign Values To Structure Elements In A List?

Aug 19, 2011

I have a user defined structure in a list that I am trying to change the value for in an individual element within the list of structures. Accessing the element is not a problem. However, the compiler complains

"Expression is a value and therefore cannot be the target of the assignment"when I try to update the value.For example:

Public Structure Person
Dim first as String
Dim last as String
Dim age as Integer

[code]....

View 2 Replies

Return Values With Reference Arguments Or By Structure?

Jul 10, 2009

In what situtations is it best to use reference arguments to return values?

Sub Example(byref value as integer)
value = 3
End Sub

In what situations is it best to return the value (perhaps in a structure for more complex types)?

Function Example() as integer
return 3
End Function

View 3 Replies

Structure Values Change In Multiple Places?

Mar 21, 2009

I have created two structures, one named "Product" and the other named "Item". These structures are quite similar but are at the same time quite different from each other. The structure definitions are as follows. Ultimately, I declare arrays in my containing class which access these structures as a type. Their declaration: "Products() as Product" and "Items() as Item". All has been fine and dandy until one day, I go to change the items Enabled() values, and something happens. Not only does it change the Items(index).Enabled(index) value, it does it on the corresponding Products(index).Enabled(index) value, even though it was never specified to do so. Also, nowhere in my coding have i defined this sort of thing to occur. It is rediculous, because I watch it happen. I turn on the watch window, and debug one step at a time, and every time, I watch the Item line step, I look down at the arrays of products and items, and both values have changed. How do I get this to stop, and only change the Item.Enable value??

<Serializable()> _
Public Structure Product
Public Name As String

[code]......

View 2 Replies

Class/structure To Serialize JSON?

Mar 9, 2011

I am trying to figure out a class/struture to handle the following JSON format:

{
"ReturnData": [
{
"id": "msg2DoesNotExistName",

[Code]......

I may or may not have Data for ReturnData and SetValue (one or both at a minimum). I am trying to let the serializer handle most of the formatting without having to check for empty sections and single-item arrays.

View 1 Replies

Possible To Show Structure Of A Class In A Treeview?

May 31, 2009

is it possible to show the structure of a class in a treeview? if yes how

View 3 Replies

Reflection On Structure Differs From Class?

Jan 15, 2009

Code snippet:

Dim target As Object
' target gets properly set to something of the desired type
Dim field As FieldInfo = target.GetType.GetField("fieldName", _
BindingFlags.Instance Or BindingFlags.Public Or BindingFlags.NonPublic)
field.SetValue(target,newValue)

This snippet works perfectly IF target is set to an instance of a CLASS.However, if target is set to an instance of a STRUCTURE, the code does not actually change the value of the field. No error, but the value remains unchanged.And, oddly, if I'm stepping through code, watch the SetValue fail to do anything, and immediately go to the Immediate window and type exactly the same SetValue operation, that works.

Edit:

Per request from Jon Skeet, actual code:
Private Shared Function XmlDeserializeObject(ByVal objectType As Type, _
ByVal deserializedID As String) As Object[code].....

View 2 Replies

[2008] Size Structure In A Class?

Mar 6, 2009

I am making a class that has a property that I want to be of type System.Drawing.Size. I don't seem to be able to reference system.drawing from within my class, and therefor can't set my property's data type to Size. Anyone know how I might do this?

View 2 Replies

Expected The Db_con Structure To Be Populated With Values After The Call?

May 31, 2012

In a public module (codefile) I defined a data structure called db_connection,then declared a variable of that type like so: Public db_con as db_connection I pass db_con to a sub. I expected the db_con structure to be populated with values after the call to the sub. It does not.This is something I have done for years in vb6.What might have changed to prevent this from working?

View 2 Replies

Build A Class Structure To Support Two Threads?

Nov 8, 2009

I have this application that users can make exams that contain exercises of different ... whatever. Anyway when student takes the exam he chooses it from a list and then all exercises are loaded from database. I wanted to make loading process faster by loading only first exercise data and putting others in background thread.

Actually in other parts of this application something like that is done but not by me. Basicaly an api class is built around BackgroudWorker and i can use this class to put certain functions of objects to be executed in background. The idea sounds great but in real life there are some problems with it. For example for historical reasons this application uses global functions and reader and uses global connection to Access database which means if in background something is being fectched from data base and you try to fetch from database in main thread then a „reader is already open" error occurs. To avoid this error if im doing something in main thread and want to fetch some data i have to move my function from main thread into background worker function list. And basically this in my opinion stinks cuz you end up with many delegātes, invoked checking and thre result... I was just thinking that there maybe is another way to allow (maybe with events) not put everything in background in case something is happening in bakcground but rather allow bgworker to finsih current thing, then do my thing and then resume bgWorker and not create havoc in code.

Basically i have to classes - exam and exercise that each implement many interfaces (like IExercise, IExerciseResult, IExerciseYesNo, IExerciseMultipleChoise etc.)And then i have DataBase classes like ExerciseDB, ExerciseResult etc. That have functions that preparē the sql params and call sqlHelper functions.And for example when i load up exam i go throug all exercises and call LoadData function that in turn calls ExerciseDB function selectData and then i put the returned data in Exercise object. And this type of thing of course would producē error if i at the same time would try to register the answer in database for another exercise. Ofcourse i could always check and put this in background... but as i said i'd rather want to work with database from both threads.

View 13 Replies

Class - Internationalization In .Net : Choosing The Right Structure Type?

Jan 22, 2010

I'm about to start translating my vb.net application, and I don't want to use the default methods provided by Visual Studio to do so. I need my application to be very light, and it nearly doubles it size to use the resources option.Therefore, I'm planning to use some thing like a class, of which I would have one instance per language. Since I don't want to distribute language files as separate files (I'd rather have them hard-coded), I would like to find an easy way to check if every field of the class is initialized. I was thinking of something like an Interface, where I would do something like this:

Public Interface Language
Dim HelloMsg As String
Dim GoodbyeMsg As String
End Interface

[code]....

It's obviously not the right way to do it (although I could use properties instead of vars), but I was wondering whether the was a way to have the compiler check that everything is translated and warn about it if not.

View 2 Replies







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