.net - Data Structure For Text Adventure?

Nov 6, 2011

I'm designing a choice based adventure game in VB.NET 2010, where you are presented with a story label, and you choose between 2 buttons, which choice you want to make. I want to know the most efficient way to do this.My goals are to store the labels for the buttons and the story in some form of data structure, which is temporarily a hash table right now, and some form of structure for the choices. Right now I am using a custom class that references the indexes of the next 2 choices and their respective label indexes which stores the class instances in a hashtable.I've looked into things like arrays, dictionaries, lists, and collections, but I'm not sure which one best fits what I'm after. Any .NET data structure would work. What is the most efficient data structure for these 2 pieces of data? Would just a string array work?

View 2 Replies


ADVERTISEMENT

Save Progress In Text Adventure?

Apr 27, 2011

I've set up buttons with the Save Dialog and Open Dialog in Visual Basic 2010, but It doesn't really do anything when I save, and there's nothing there when I try to open. I didn't actually put any code in the dialogs or anything. Basically, I just want to beable to have an option in my VB2010 text adventure game for the user to save his/her progress.

View 8 Replies

Take Data From A Text File And Place It Into A Structure?

Oct 8, 2010

Attempting to take data from a text file and place it into a structure.

Option Strict On
Imports System.IO
Public Class Form1
Structure Employee

[code]....

View 3 Replies

Array Structure - Store Data And Retrieve From Text File

Mar 29, 2010

I'm trying to build something called a structure which will store data it retrieves from a text file. I have the structure set up like this:
Structure Employee
Dim FirstName As String
Dim LastName As String
Dim ID As String
Dim Hours As Integer
Dim Wage As Decimal
Dim EarnedPay As Decimal
End Structure
[Code] .....
How to set these operations up?

View 10 Replies

Variables - Combining Multiple Data Types Into A Single Unified Data Structure

Mar 16, 2012

In VB.NET I would like to create a complicated data structure with multiple types of data stored in an array like format (see below). I am trying to create a data structure that would look something like this: [Name; xLoc; yLoc; zLoc; [Jagged Array]] Note: Name needs to be dimensioned as a string, xLoc and so forth as integers. The Jagged Array would look like this:

[Code]...

View 1 Replies

Need Right Data Structure

Jun 22, 2010

I have a list of a few thousand names. I actually have last name, first name, phone number, etc and more info. I'm going to make a class to contain the data. so I'll have like a people object with for example a last name field. I'm going to store these in like an array list. Lets say i have 100 items in array list. Maybe last name smith is on index 3 21 and 63. I'd like a data structure where i can easily search for smith and get indexes 3 21 and 63. Brute force is simply loop through complete array checking last name and grabbing index each time i find smith. Ideally id like to have more efficiency. In c++ I'd use a multi map but i don't see that that exists in vb.net. A dictionary wont work because its 1:1.Name of data structure, short description of how to use it and web help reference page would be nice.

View 2 Replies

Use Data Structure In VBA ?

Feb 14, 2008

I would like to use data structure in VBA. the code like

Public Structure employee

Public firstName As StringPublic middleName As String

End Structure

But there was compile error: Expected :end of statement. Can I use data structure statement in this way? how to use data structure in VBA?

View 4 Replies

Text File Into Structure?

May 8, 2011

New to VB programming and am attempting a small database project. Attempting to take data from a text file and place it into a structure.

[Code]...

View 8 Replies

Changing Data In A Structure?

Nov 25, 2009

I have some structures and I change the data inside a loop. This works ok. But as soon as the method ends, all values in the structure are reset???

Heres my

Private Sub ReadDevice(ByRef device As Device)
Console.WriteLine(" Reading device " & Device.name)
Dim data As Short

[Code].....

View 5 Replies

Bind A Text Box To A Structure Element?

Feb 6, 2011

I would like to bind the text field of a textbox to an element in an instance of a structure that I've created in a class module. When I try to create a Data Source using an OBJECT type, all I see in the tree is the name of the structure, not the instance I've created. If I select the structure anyway, the Data Sources tree does show the name of the structure and the element I'm interested in. How do I bind to a specific instance?

View 1 Replies

Calling Function On DLL To Get Data From Structure?

Apr 16, 2012

I have problem about how I call a function on DLL to get data from a structure. Have a C++ example about how it's works the library, and I want to use it on vb.net. his is the working c++ example:

Declaration:
BOOL (WINAPIV* MyFun)(DWORD start1, DWORD stop1, P_RESULT pResult, PDWORD pTpNum, myCALLBACK lpFunc) = NULL;

Call:
// pStruc = RESULT structure
// TrpNum1, TrpNum is ULONG
ULONG TrpNum1=0;
MyFun(Start,Stop,pStruc+TrpNum,&TrpNum1,&myCB);

Callback:
void __stdcall myCB (RESULT *pStruc) {
printf ("%.3f", (double)pStruc->val1);
tpn++;
[Code] .....

The error is this: "Attempted to read or write protected memory. This often indicates that other memory is corrupt."

View 1 Replies

Fill A Structure With Data From A SQL Table?

Feb 7, 2011

Is there an easy way to get data from a table in SQL Express and put it into a Structure? The table has one string column and five bit columns. I'm using VB.net

View 13 Replies

How To Pass Structure Into A Data Layer

Feb 19, 2011

I'm creating a Data Layer for a Web Application and in one of my functions, I need to pass in a Structure full of Customer info. This Data Layer is essentially a DLL. My problem is that I'm not sure how to do this.Below is my code and what I want to do.

[Code]...

View 5 Replies

Integer Data Type Is Structure?

Mar 7, 2010

Is the integer data type is structure? And if yes what is the original code of it?

View 2 Replies

Store Data In An Array Using A Structure?

Jun 6, 2011

im tryin to store data in an array using a structure. However, the code im using keeps returning a null referece exception, even when there is something in the input boxes. This is the code im using:

With SaveInfo(Index)
.EmployeeID = EmployeeIDComboBox.Text
.EmployeeName = EmployeeNameBox.Text

[Code].....

View 6 Replies

Structure For Large Quantities Of Data?

Jul 3, 2010

I have a large amount of data (400 variables recorded 2 times per second) which is output from a factory monitoring system. It is stored in encrypted files in blocks of one hour from which i can extract to csv with a small piece of software.I would like to upload these csv files into a single database from where i can make graphs, analysis or whatever over longer periods.

The csv files have one line of data per 'time stamp', each of which can be conceptually segregated into approximately 15 individual pieces of equipment.I can quite easily import the data into a single table. However, i find that, very quickly, i end up with an enormous file (about 700mb/month) which is extremely ponderous to work with.

is it possible to split the table into 15 separate tables related by 'time stamp' and second, can each of these separate tables be saved in separate files in storage memory (such that only the files with the desired data are imported into ram).

View 13 Replies

Adding Textbox Name And Text To ArrayList Using Structure?

May 20, 2011

I have a function which iterates through the TextBoxes in my form (and its child controls) and adds each TextBox's name and text to an ArrayList using a structure I called valTxtBox.

Here's a snippet of the
VB.NET
Public Structure valTxtBox
Public nome As String
Public texto As String
End Structure
[Code] .....

Now, the problem is that if I call Clear() for valsTxtBox in the getctrls() function, not all the elements get added to the ArrayList. However, if I don't call Clear() it works just fine. BTW, I'm using VS2008 express which might be relevant.

View 5 Replies

Text File To An Array Of A Structure And Search?

May 10, 2009

currently working through a project using VB 2008 windows form application and having a little trouble with the code. I need to read data from a text file into an array of a structure, displayed in a list box and have a number of searches conducted on the data and these results displayed on the form. The test data is of rainfall across a number of areas and is in the format:

View 10 Replies

Structure Inside Another Structure Receives Null Reference Error?

Jan 5, 2012

Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module

View 17 Replies

Array In Structure Apparently Not Retaining Data?

May 6, 2012

I have a structure with 6 arrays inside it that is serializable so I can save the arraylist of them to a file and load them from the file. This part works.

When loaded from the file the data from a single specific record is populated to a listview control, this works on form load. The user can then select different records and in theory display the data in them (specifically the stuff in the arrays).

Displaying the data works as I'm editing the data, and on first load of the form and displaying the "default" record from the structures. Any other time (trying to switch between records during editing or after loading) the record is pulled (as shown by stepping through the code line by line) but the data in the arrays in the structure and only the data in the arrays is missing.

I've gone through all the code that runs and there is nothing that overwrites the array data in the records between displays so I'm at a complete loss as to why this data is going missing.

Below is the structure and the code.

Defined in a Module so as to be accessible when needed in several places through the program:

Public JBonus As New JobBonuses
Public JBonuslist As New ArrayList

On load to set dimensions to the arrays:

JBonus.Str = New Integer(999) {}
JBonus.Agi = New Integer(999) {}
JBonus.Vit = New Integer(999) {}

[Code].....

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

Asp.net - Preserve Data-structure On AJAX Postback

Dec 29, 2009

[Code]...

The first time the page loads my structrure is filled correctly. After an AJAX postback all the structure fields are setting to nothing. (It seems that the Dim OldPInfo As New PInfo is called again), but i should better ask the SO Experts.

View 1 Replies

Copy Data From One DataTable To Another With Diffrent Structure?

Apr 23, 2011

I am copying data from DataTable to another DataTable with a structure.I have to hardcode coulums number in the loop and copy the data in object array.[code]...

View 2 Replies

Data Structure Memory - System Resources

Feb 27, 2009

I was wondering if there was a way to find out how much memory a data structure too up. So say I declared a list of strings.
Dim theRN As New Dictionary(Of String, Integer)
Say it had 25 elements in it. How to find out how much memory those 25 elements are costing me?

View 3 Replies

Data Structure To Represent Bookable Timeslots

Apr 27, 2009

What suggestions do people have for a timeslot data structure? I have a number of activities and I'm planning to display them in a datagrid with days as columns and timeslots as rows. This suggests to me a timeslot data structure with 5 properties for the five days (the columns) for every value I want to use e.g. a timeslot ID and the number of slots left.

So.

Property Day1ID
Property Day1Slots
Property Day2ID
Property Day2Slots
Property Day3ID
Property Day4Slots
etc

Then each TimeSlot structure would be for a specific time. say 9:00 and another for each hour after that. Then I'd have a list of timeslot structures that will auto bind against the datagrid. I'm exploring new ground here and as you can see I'm not very clear on what/how to do it?

View 2 Replies

Extracting Data From CSV File Into Searchable Structure?

Jun 25, 2010

I have a csv file with 48 columns of data. I need to open this file, place it into a data structure and then search that data and present it in a DataRepeater. So far I have successfully used CSVReader to extract the data and bind it to myDataRepeater. However I am now struggling to place the data in a table so that I can filter the results. I do not want to use SQL or any other database.

So far, this is working in returning all records:
Private Sub BindCsv()
' open the file "data.csv" which is a CSV file with headers"
Dim dirInfo As New DirectoryInfo(Server.MapPath("~/ftp/"))
Dim fileLocation As String = dirInfo.ToString & "data.txt"
Using csv As New CsvReader(New StreamReader(fileLocation), True)
[Code] .....

View 2 Replies

Saving And Loading Data Structure Items

Jun 20, 2012

I am quite new to VB.NET and I am attempting to create a console application that can write, save, load and edit sets of data. Lets say I have something like this:

[Code]...

However, I have no idea how to load the data so I can manipulate it in the EMPLOYEE structure system. I am not sure if I have made my question clear enough, for as you can see I'm quite new to programming and am not essentially familiar with the terms of speech.

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

Converting Structure Within Structure To Byte Array For Socket

Aug 29, 2009

I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.

I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.

Public Structure MESSAGETYPE_OIP_Login
Dim Header() As COMMANDHEADER
Dim UserName() As PSTRING

[Code]....

View 2 Replies

Another Method To Reference The Array And The Member Of The Structure To Get The Data?

Jan 31, 2010

I have problems with array of structures.my structures are like this

structure order
xxxxxxxxxxx
yyyyyyyyyy
zzzzzzzzzzz
end structure

and then I created many array of structures, like this private arrayorder (100) as order

now i need to sort the entire xxxxxx member of the array of the structure with a function, but I dont want to use loops with arrays indexes to access the information. I want to know if there is another method to reference the array and the member of the structure to get the data.

View 2 Replies







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