VS 2010 Structures In A Webservice .Net?

Dec 7, 2010

I have built a webservice to take order information..

[Code]...

My clients use the code above to enter multiple orders without any issues, but I need to be able to add multiple Products to each of the orders. I cannot figure out how to add the contents of the Product Structure into a GenericList, within the OrderList.

View 2 Replies


ADVERTISEMENT

VS 2010 - Classes Vs Structures?

Dec 11, 2011

For the time being I have been using a Structure to store "people" (their name, gender, age, etc...), because I really love to refer to something like Mike.name or Caroline.age, so I could simply put Caroline.age += 1 anywhere in the code and here you go, Caroline is one year older. No more simpler.But because of how inflexible (compared to Classes) Structures appear to be, when I needed to iterate through all the instances I was forced to use a list or dictionary so I could use a FOR EACH ... NEXT block. That was resolved by you people in the previous post, but I'm having the problem that I couldn't use the elements of the list to change the original instance of the Structure proper... I mean, if I code something like this...

For Each thisperson As Person In peoplelist
If thisperson.name = person_selected Then
'person_selected is the SelectedItem.ToString of a listbox[code]....

Well, I thought that thisperson.teamleader and Mike.teamleader were going to be equivalent (when the IF statement was true, that is) but that doesn't appear to be the case. So right now I'm really hating Structures...But when I look into Classes... well, they have more flexibility, yes. You could construct a FOR EACH block without any other trick like the "on-top" list, and that it's very useful indeed, but (a big "but" IMHO) I lose that NICE feature that makes possible to write the name of one of them instances like Mike.age or Caroline. kills

I mean, if I wanted to add a year to Mike, well... there is no "Mike" in the first place. A "Mike" string could be a property for the class, but I cannot (or know) magically refer to him with the ease of a Structure, so when I want something so simple as Mike.age +=1 ...well, with a Class I'm simply clueless to how locate him and change ANOTHER property of him.I suppose I am doing something very wrong, because I cannot believe VBasic could force on you those two extreme philosophies...:

Classes = +flexibility -usability ???

Structures = -flexibility +usability ???

What I want to do is SO simple that I cannot believe I need to choose between the two.

View 25 Replies

VS 2010 IM STUCK On Structures

Sep 15, 2011

These are the instructions. Create a Visual Basic program that reads in baseball player information from a form and holds all of the player information for an entire baseball team (20 players). A baseball player consists of a first name, last name, number, position, and batting average. The form should contain 3 buttons Add Player, Display Players, and Exit.

[Code]....

View 6 Replies

(2005) Arrays Of Structures Within Structures?

Jan 20, 2009

I have a structure called 'Scheme' and in my program I want (ideally) an ArrayList of 'Schemes' (so i can add, remove schemes etc.). However, within the 'Scheme' structure, I want to have an ArrayList of 'Item''Item' is another structure. Are there any solutions out there for iterating through these arrays quite easily?

How can I easily add multiple Items to a Scheme and mutliple Schemes to my Scheme array. Code is below. When I try to add Items to a Scheme, I get the 'Object not set to a reference of an object, try the 'New' keyword', but you cannot declare 'New' keywork within a structure.

[Code]...

View 4 Replies

VS 2010 Iterate Through Elements In Structures?

Dec 10, 2011

I have a public structure in the same form I'm working with, like this...:

Public Structure Person
Public name As String
Public age As Integer

[Code]....

At the start of the code I've declared some 'Person' instances...:

Public TeamMember1 As Person
Public TeamMember2 As Person
Public TeamMember3 As Person

[Code]....

I don't know what to put at ??????. If we were talking about control objects I would write Me.Controls("TeamMember" & n) and that would work. But with a public structure I don't know how to refer to it.

Is it even possible? And if not, how would you do what I'm trying to accomplish?

I only want to run that 'If' statement with every team member which I have, and right now the only way I know to do it is to create 10 (!) of those 'If", and only change the team member number at the end. And that's horrible...

View 5 Replies

VS 2010 Structures Into Binary File And Vice Versa

Dec 10, 2010

I save data entered by user into a structure like this

[Code]...

Q1. How can i save that structure into file using binary read write methods.
Ans. [URL]

Q2. How can i save that structure array into file using binary read write methods.
Ans. link to some other tutorial or resource if u know

View 7 Replies

Structures And Arrays Of Structures?

Jun 2, 2010

I read in the Book "Mastering Microsoft Visual Basic 2008" about "User-Defined data types".The example given is creating a Structure as follows.I wanted to check that so I wrote all the code given; I used a TextBox and a Button for this.(I didn't include the "CheckDate" here; that is in the book)

Structure CheckRecord
Dim CheckNumber As Integer

[code]....

The problem is this does work.What I get is "00000". and I found out that the "Checks(4)" Array does hold any value ie: on keeping the cursor over that, it shows "CheckAmount 0.0, CheckNumber 0 , CheckPaidTo Nothing ".

View 1 Replies

Create A List Of Structures Within A List Of Structures?

Jul 20, 2009

I'm attempting to create a list of structures that contains a list of structures. I can't seem to figure out how to properly allocate the object for the inner list of structures. I expect the outer list of structures to have a couple thousand entries and the inner list of structures to be fairly small at 2 to 10. Both lists will grow over time but the number of elements within the inner list will be constant for an instance of the outer list. Meaning, if an instance of the outer list has 2000 entries each of those will have the same number of elements on the inner list, say 4 entries.

Here is a simplified code fragment. This fragment makes no attempt to create the instance of the inner list "StructBlist" since I can't figure out where to put it. Tried "New List(Of StructB)" in the declaration as well as "Alist(0).StructBlist = New List(Of StructB)" but neither works.

Public Class Form1
Structure StructA
Dim FieldA1 As Integer

[Code]....

View 5 Replies

Translate PHP Json Webservice Request TO .Net Json Webservice Request?

Jun 13, 2011

I have to send a request to Webservice and I have a working PHP solution, that I have to translate in VB.net

Here's the code working in PHP

//fill in the details of the contacts.userId is obtained from loginResult.
$contactData = array('lastname'=>'Valiant', 'assigned_user_id'=>$userId);
//encode the object in JSON format to communicate with the server.

[code]....

Naturally I imported a reference to a Json library and Imported (Imports Newtonsoft.Json)?

View 1 Replies

Different Between These 2 Structures?

Mar 28, 2010

What is the different between these 2 structures?

Structure INPUT
Public dwType As InputType
Public mi As MOUSEINPUT
Public ki As KEYBDINPUT
End Structure

[Code]...

View 1 Replies

2 Structures Using Eachother?

May 14, 2011

Structure TextureStruct

Dim unk1 As ULong 'always 0x70007
Dim unk2 As ULong 'always 0x70007
Dim unk3 As ULong 'always 0x70007
Dim unk4 As ULong 'always 0x70007
Dim unk5 As ULong 'always 0x70007
Dim unk6 As ULong 'always 0x70007

[Code]...

View 4 Replies

Get A List Of Structures?

Jun 5, 2010

Is it possible to declare a new list inside a structure.

I'm trying to get a list of structures that each contain a list of points,

but when i try to declare a new list inside the structure VB says "keyword not valid as an identifier"

View 2 Replies

Using Arrays In/with Structures?

May 24, 2009

I'm currently doing this project where i have to create a program that let's the administrator manage students (and their tests.) I have decided to use Random Access file in this project.because structures will need fixed lengths...i don't know how will i search through the students (a function of the program) when each student structure has a different length because of the number of tests they've done.* I have created a variable in the aStudent structure so that i can know the number of tests a student has done...but don't know how to use it.

Public Class FormAdmin
Dim currentStudentName As String
Dim currentStudentID As Integer = 0

[code]....

View 3 Replies

Using Arrays With Structures?

Jun 18, 2011

I have created a structure as below. I want the structure to be an array...so I can use a call like picks(1).a or picks.a(1) = blah blah. I don't understand how to use an array of a structure..

Public Structure apicks
Dim a As String
Dim b As String
End Structure

View 3 Replies

Using The Nested Structures

Mar 8, 2010

I have been trying to read the cd toc in one go from the API, I can read it OK with a single byte array, but I can't find a way to fill the formatted arrays

Code:

'ORIGINAL STRUCTS
'MAXIMUM_NUMBER_TRACKS = 99
'typedef struct _CDROM_TOC {
' UCHAR Length[2];

[code].....

View 2 Replies

Add & Delete From Arrays Of Structures?

May 22, 2011

what is the best way to add, delete elements from arrays of structures structure

vb
Structure Proxy
Dim Server As String

[Code].....

View 7 Replies

Cycling Through Data Structures?

Jan 21, 2010

I am currently working on a project for myself which looks through employee's information to find their availability to work. I've tried making a structure which holds the employee's information but I can't think of a good way to create different instances of it and store information in it at runtime. I'd prefer to load the information in at startup and not have to declare each employee and information. I am very new to Visual Basic 2008 but I have a good grasp of arrays from C and C++.

View 3 Replies

Difference Between Classes And Structures

Oct 23, 2010

I know that Structures are value types and classes are reference type, i know that since structures are stored in stack they are faster to use i also understands that structures can not use the Inheritance concept but still in most examples i see i always see that the authors use classes when building something like BBL library, if structures is light-weight compare to classes and i don't need it to be inherited should i use structure instead of class?is there a rule of when to use class and when to use structure ?

View 2 Replies

Include Functions In Structures?

May 1, 2012

lets say its something like[code]...

i want to add a function like this inside the structure

View 2 Replies

Initialising An Array Of Structures

Nov 7, 2009

I have a Structure, and I am having trouble initialising it. Specifically when I try to populate the Vector3 variables, it tells me that they are Nothing, so I need to make them New when the array of this structure is declared.[code]Structures cannot declare a non-shared 'Sub New' with no parameters.I have no parameter to supply, and this will be an array so I'm not even sure how I would supply it.The second option to fix the error is to make the Sub New shared, but then I get other errors: Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.Does anyone know how I can resolve this. My end goal is to have an array of this structure type with the Vector3s ready to use.

View 6 Replies

Iterate Through A Collection Of Structures?

Mar 10, 2009

I have created a collection of structures. Each structure, of course, contains fields.

Lets say something like:
Public Structure clientStructure
Public ID As String
Public firstName As String

[Code]....

How can I access a field of a particular structure using for.... each?

That is, how can I retrieve out of the collection (lets say item 5's) firstName, using for...each?

View 2 Replies

Lists() And Data Structures

Sep 1, 2009

Can a list class in vb.net contain Data Structures ?

View 1 Replies

Loop Structures For A ListBox?

Jul 26, 2009

Just a little frustrated with a simple error in a listbox result on a mobile application.Here is a sample of the results I should be getting:

The inputs are 50mph & 4.5 hours
Hour distance
1 50

[code].....

View 1 Replies

Need To Have An Array Of UDTs(Structures)

Feb 21, 2012

I need to have an Array of UDTs(Structures). Elements have to be added (at end) and removed (from anywhere). The different values of the elements need to be changeable.

I know how to implement it as an oldstyle array, but wouldn't it be better to implement as a List ( of T)? and if yes is such a procedure possible?[code...]

View 8 Replies

Optional Structures As Arguments?

Mar 16, 2011

It says that I can't have structures as optional arguments.That's really annoying for my program. Isn't there any way to circumvent this?

Sub fa(Optional ByVal colz As System.Drawing.Color = Color.AliceBlue)
End Sub

This example cannot compile

View 14 Replies

Restricting An Interface To Structures Only?

Aug 4, 2011

I have an interface IDigitalState defined as

Public Interface IDigitalState
ReadOnly Property Code As Integer
ReadOnly Property Name As String
End Interface

[Code]....

What I wanted to do was declare a variable as a nullable type of IDigitalState. I understand why I cant do this because the interface may be implemented by a class which is not allowed to be nullable. Is there a way to define the interface so that it can only be implemented by a structure.

View 2 Replies

Save An Array Of Structures In .NET?

May 31, 2011

I have 2 Structures

Public Structure One
Public ItemOne As String
Public ItemTwo As Integer
End Structure

[Code]...

Results In an Unhandled exception. Bad Record Length. and then If I close it and reopen it I get an 'Unable to read beyond end of stream' error. So what is the best way to save an array of structures? Binary Reader/Writer? and why does this way not work (Even if its derived from VB6)

View 2 Replies

Saving And Writing Structures?

Jan 29, 2011

The following is a mini version of a data structure that I need to be able to write & save to disk. Can someone give me a sample of code needed to do this

Public CardType
Card(0 to 52) as Integer
Suit(0 to 52) as Integer

[code]....

View 2 Replies

Sort An Array Of Structures In .NET?

Nov 17, 2009

I have an array of structures:
Structure stCar
Dim Name As String

[code].....

View 4 Replies

Sorting Structures By Different Elements?

Mar 30, 2011

I have a structure

Structure record
dim firstName as string
dim lastName as string
dim phoneNumber as string
dim email as string
dim address as string
end structure

View 8 Replies







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