Lists() And Data Structures
Sep 1, 2009Can a list class in vb.net contain Data Structures ?
View 1 RepliesCan a list class in vb.net contain Data Structures ?
View 1 RepliesI'd like to give a homework assignment to a person learning VB.NET. I'd like it to use basic inheritance and a variety of data structures including queues, lists, arrays, or stacks in a windows forms application. I was thinking of a pizza-ordering application. This would allow them to utilize some basic inheritance and practice using .NET UI elements.
View 2 RepliesI 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 RepliesI'm wrangling with issues regarding how character equipment and attributes are stored within my game.My characters and equippable items have 22 different total attributes (HP, MP, ATP, DFP). A character has their base-statistics and can equip up to four items at one time.[code]Final character ATP in this case would be 88.I'm looking for a way to implement this in my code. Well, I already have this implemented but it isn't elegant. Right now, I have ClassA that stores these attributes in an array. Then, I have ClassB that takes five ClassA and will add up the values and return the final attribute.However, I need to emphasize that this isn't an elegant solution. There has to be some better way to access and manipulate these attributes, including data structures that I haven't thought of using.I should note that there are some restrictions on these attributes that I need to be put in place.E.g.,these are the baselines.For instance, the character's own HP and MP cannot be more than the baseline and cannot be less than 0, whereas the ATP and MST can be. I also currently cannot enforce these constraints without hacking what I currently have :(
View 1 RepliesI 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]...
I have a List Table (lstTable) that is on the same form that I am trying to fill in with information from a public structure (ELEM_DATA). I understand nested with statements will work if it is within the same scope but how can I do this with example 2 below:
Example 1:
With me.lstTable.Items(RECORD)
.SubItems(1).text = ELEM_DATA(RECORD).name
.SubItems(2).text = ELEM_DATA(RECORD).number
end with
[code]....
I didnt know if it is possible or if it would be as simple as changing (.name) to something else.
I am trying to get the data from the text file to load into an array of structures and then be displayed in a listbox on FormLoad with no luck, all I get is a blank listbox.
Code:
Public Class frmMemList
'Create a structure to which data from text file MEMBERPHONES.TXT will be read.
Structure MemberList
[code]....
I am really struggling lately for some reason. I do not know why, but I can not get simple programming code to work, usually due to simple mistakes. Anyway, enough about that.Here is my code, I am trying to get the data from the text file to load into an array of structures and then be displayed in a listbox on F
Public Class frmMemList
'Create a structure to which data from text file MEMBERPHONES.TXT will be read.
Structure MemberList
[code].....
I need to create a collection of millions of objects, each object has 3 double and one integer fields.If I remember (after more than 20 years without using C) in C you would allocate enough memory using a struct and an array, and read all the file content in one shot.In VB I created a class with the 4 members, and this constructor:
Sub New(BR As IO.BinaryReader)
X = BR.ReadDouble
Y = BR.ReadDouble
[code]....
what the results I need in a Windows Form Application.
Requirement:
(1) I need to create class objects with all various methods and properties, etc.
(2) I will create only one instance of the each class
(3) I need to be able to call the methods and properties of the created class objects (1) from any form I create.
(4) I use the class objects to store data so that separate threads can access them..
Question: how I would code this into a WFA? (I have console application code that works but need to convert it into a GUI).
[Code]....
I have an XML file that looks like this.
[Code]...
i will need to get every food that is associated with almond, with american cheese, apple etc.. i will be reading the data with vb.net
I'm working on something whereby I write and read alot of data to disk directly as bytes. But I can't figure out a foolproof way of delineating data structures chained in a single file. A null byte obviously wouldn't cut it, because that could occur within the data structures themselves. Theoretically, any pattern of bytes can potentially occur within a data structure. Does anyone have any ideas for a byte pattern that I could use as a flag for my streamreader? Anything reasonably short, since it's going to be pretty complex, streaming through each file twice, once byte by byte to find the flags and again to split the stream.
View 10 RepliesI have two lists. One list is a list of names, the other list is a list of how many times each name is found in the first list noted in the database
so...
Nick
John
Jim
Jack
is the firs tlist
10
13
13
2
is the second list. Nick had 10, john 13 and so on.I want to sort the second list from large to small, but have the index for the first list still linked to the correct amount of calls.i do it this way so I can
for x = 0 to num_of_names
string = lst_name(x) & "-" & lst_count(x)
next x
I've got a couple of drop down lists for languages. I bind them to a language list that comes from a query. Then the fields are also bound to the row in the DB they relate to. I have several panels with the language drop down - each "tied" to a different table in my DB. When I call up different records on the same panel the drop downs immediately "set to the position" of that rows language in the list. But when I call up another panel - tied to another database table - I see that language in the drop down.
[Code]...
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 ".
I know how to check whether an item exists in a list using (MyList.Contains), But I do not know how to check the whole list. For example (use one button and one richtextbox):
[Code]...
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]....
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]...
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]...
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"
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]....
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
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].....
what is the best way to add, delete elements from arrays of structures structure
vb
Structure Proxy
Dim Server As String
[Code].....
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 Replieslets say its something like[code]...
i want to add a function like this inside the structure
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 RepliesI 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?
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].....
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...]