Structures And Arrays In VB (VS 2008)?

Mar 14, 2010

I would be more that happy for someone to tell me I am missing something very simple here I am writing code that - amongst other things - talks to code on other servers using the tcpclient function in .net

What I want to do is - in essense very simply. I want to define a structure which includes an array load it with data and sent it to the other end of the socket.

[Code]...

View 4 Replies


ADVERTISEMENT

[2008] Running Arrays From Structures?

Feb 16, 2009

i am currently running a program that will allow me to save all data on the form to open and edit at will. It uses a structure of 8 arrays, each with 16 values to save the information.

When i try to save the text into the array, it tells me that its a bad record length and crashes.

Here is the

Public Structure save_weekly
<VBFixedString(8)> Public dates() As String
<VBFixedString(30)> Public description() As String

[Code].....

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

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

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

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

Creating A Database Using Structures And Arrays?

Nov 15, 2011

I want to create a relational database in VB2010 and I am attempting to accomplish this goal by creating a structure of records to be stored in a Random Access File.For each record, I want to organize each fixed-length record so that 4-integer sets of data are stored into a a multi-dimensional array.But when I try to write the code below at the module level, I get an error.

Structure PictureDat
'len= needed for Open
of Random Access File [code].....

Since I want to read/write/save the data in this structure to a Random Access File with a fixed record length size, I need to exactly specify the size of the record...which is, of course, determined by the array's dimensions.If I could accomplish this strategy, then I could search this random access file for a match of search criteria consisting of 4-integers with any of the 4-integer sets of data in each record and thus find, edit, delete and search records...therby retrieve information from my database.

Is my program design inefficient? Is there a better way to handle perhaps hundreds of thousands of records? The IDE keeps telling me that I am using a deprecated method of file I/O when I use FileOpen(), FileGet(),FilePut() and should be using MyFile.I am entirely comfortable with my time-tested method of data storage that ensures the security of disk storage while exposing only one record at a time to the PC's volatile RAM, thereby not allowing all my data exposed to possible memory corruption on a PC left on for hours, which would be the case if I loaded the whole file as a monster- sized string or stream. Also, these older file access methods allows my code to run on PC's with modest amounts of memory.

View 9 Replies

Inventory Program Using Structures And Arrays

Jan 29, 2009

I have to make this program to keep track of product description, ID, price, and quantity. I am manually coding some and the user can input products as well. I want to display the product and it's ID in a listbox and put price and quantity in seperate labels. [code] My question is how do i keep the array index numbers sorted so when i click an item in the listbox it will show the price and quantity in the labels for them?

View 1 Replies

Sharing Structures Of Arrays In Multiple MDIchilds

Nov 10, 2010

I have the following code... in an MDI application. [code] Various lines of code which put data into the Myinstance and then save the instance into the ArrayList.I have buttons which run procedures and functions in the formchild and also in the Class1. I need it so you can jump between formchild instances, and when you do so and click a button on that form, it will run the Class1 code but using the data in the arraylist and myinstance that was set previously by the selected formchild. Then if you switch to another child it uses data from this form. Can this be done by declaring the arraylist with more dimensions and then refer to the records with the index of the selected form instance, e.g.Selected Child is index(3)

View 1 Replies

Sharing Structures Of Arrays In Multiple MDIchilds?

Nov 6, 2010

I have created an MDIparent form and a MDIchild. There is a button on the parent which makes multiple 'clones' of the child form, each time its clicked.I also want (maybe with a module) a set of variables, and array of a structure but these are available to each copy of the child, but each copy's variables, arraylist etc contain its own data?Therefore if you select child1 the variables and array will have different data to child2, child3...etc...

View 3 Replies

[VS2005] SafeArrayTypeMismatchException - Passing Two Structures Arrays And Other Single Values

Sep 29, 2008

I have written a ActiveX DLL in VB 6 which is like -

[Code]...

When I do this everything works fine and I am able to pass value to dll. I am passing two structures arrays and other single values like int and double etc. So far so good. But when I insert this code in another application (created in same vb.net 2005) where I actually intent it to use then i get the following error -

System.Runtime.InteropServices.SafeArrayTypeMismatchException
Specified array was not of the expected type.

I am puzzled as to why is this happening. I checked basic settings and they are same. In short the code works if i create a new project and go on but does not work and gives error if I insert in an existing application's code where i wanna use. To test I created a dll without passing structure arrays and then it worked in that application.

[Code]...

View 1 Replies

Inheritance And Variety Of Data Structures Including Queues, Lists, Arrays, Or Stacks In A Windows Forms Application

Jun 27, 2012

I'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 Replies

VS 2008 Arrays Displaying States/searching Arrays?

Oct 30, 2010

the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "

Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"

[code]....

View 1 Replies

VS 2008 - Looping Structures For Class

Dec 14, 2009

I have this Visual Basic class I'm taking online. At this point in the section all I'm supposed to know about are Do, Do While, Do Until, Exit Do, Continue Do, and For Next loops. So try not to go off in a fancy super-coder direction. And everything is (preferably) made through Console Applications on VBE 2008

Problem 1:
Write a program that evaluates the factorials of the integers from 1 to 10 using an appropriate data type. (factorials are... factorial of 1 is 1, factorial of 5 is 120, or 1*2*3*4*5=120)

Problem 2:
Make a diamond - 1 asterisk at the top, 9 asterisks at it's widest - using only nested For...Next statements to print the asterisks AND spaces, minimizing use of output statements.

View 4 Replies

VS 2008 Passing Structures Between Modules?

Apr 25, 2010

i have a main module called "main", within the module i have declared 2 other modules "Interfacing" and "Espec", within these 2 submodules they both have a structure called "coord" which is identical. The problem is that when i have defined a function in one module with "coord" as type and try to assign a value in the other module with coord type i get error message "Value of type Main.Interfacing.Coord cannot be converted to Main.Espec.Coord", so basically how could i pass that structure?

[Code]...

View 3 Replies

VS 2008 Bubble Sort Array Structures?

Apr 15, 2009

I've learned about and understand HOW to do a bubble sort (theoretically), but I can't seem to wrap my head around how to use a bubble sort with array structures. I'm supposed to be able to sort the inputted student information (via textfile) using bubble sort and display the result in a listbox. Buttons for Sort by last name, sort by gpa, & sort by letter grade.

[Code]...

View 8 Replies

VS 2008 Vending Machine Using Structures - Calculate The Change From The Structure

Aug 23, 2009

I'm having a little trouble working with structures and using a counter for the same structure. my structure gets its data from a text file which i readoff and assign ok. Here's part of my code

[Code]....

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

VB6 Used Recordsetsor Arrays - .Net Framework In VB2010. Datasets, Dataviews. Tableadapters, Arrays. Enums ?

May 9, 2010

In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.

The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?

View 3 Replies

Integer Arrays - User Enter In Big Integers Using - Two Parallel Arrays

Dec 10, 2009

My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.

'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays

[CODE]...

View 5 Replies

Passing Arrays Through Fortran Dll From App Turning To Single Element Arrays?

Feb 2, 2010

I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working

View 1 Replies

VB 2008 - How To Use Arrays Effectively

Nov 17, 2009

I am having trouble figuring out how to use arrays effectively. I am trying to use them to store a data from text boxes and and then retrieve the data that's been stored.

View 15 Replies

VS 2008 2D Arrays And Mazes?

Nov 6, 2009

I have a 2 dimensional array. Im trying to use it to generate a maze via some algorithms. Its pretty much way over my head though.But thats beside the point. If i need each array coordinate to store multiple values (like if south, west, north, east has walls), what would be a clever way to do so?

For instance:1, 1 in the array needs to keep track of 4 values at least (as do all other positions).

Should i make it an integer value like "1111" and replace with 0's where the wall is gone? the first 1 being north, second being east e.t.c. Would you choose this option?If someone wants to do a bit more research, here is some info on mazes:[URL]..

View 6 Replies

VS 2008 Adding Arrays

Apr 17, 2010

i have ReceivingArray(100, 1) and Function(1), what i want to do is ReceivingArray(x, ) = Function(1) so that goes here^-----------this but i cant figure out how to do that

View 7 Replies

VS 2008 Arrays And Function?

Jun 17, 2011

I am getting records in my dataTable that have nullvalues and need to pass each of those through a function that gets the missing value. In this case my records are address's that are missing the "Latitude" and or "Longitude" Field

I need to be able to retrieve the values and place them in the missing column and row

Nulladdress
Public Function GetNullAddress() As Address()
Dim Addresss = (From row In dtsold.AsEnumerable() _
Where row.IsNull("Latitude") OrElse row.IsNull("Longitude") _

[Code]...

View 4 Replies

VS 2008 Arrays And Strings?

Apr 27, 2009

I have been summoned with the task of taking a tab delimited file and converting that file so it can be read by a third-party program. I am trying to think of the best way to do this, but I am having a hard time. Here is a view of the raw data that must be altered:

fkstoreidHeaderMarkB1RegNodateofbusinessNoRegEntriesTipsOverRingsVoids$Voids#NetSalesDP1_2GuestsDP3GuestsDP4GuestsDetailMarkfkdaypartidRecTypeGLB2Sales
1061HNULL101/01/2008NULLNULLNULL113.263512785.4714453137D2041005NULL2220.25
1061HNULL101/01/2008NULLNULLNULL113.263512785.4714453137D3041005NULL9170.19
1061HNULL101/01/2008NULLNULLNULL113.263512785.4714453137D4041005NULL670.75

[Code]...

I am toiling with the best way of doing this. So far, I am not having much luck. I have used arrays quite successfully in Java, but I am not sure that this is the best way to go here. I would have to get how many lines there are and read each line. Make the changes, and then go on to the next line. I think scanning the document line by line using a loop is the best way. However, I am not sure.

View 4 Replies

VS 2008 Arrays From Textfile?

Apr 26, 2011

I'm working on a program for a class of mine but the ideas of arrays from a textfile just doesn't seem to click.

When the program loads, it should display the title of 17 books from the textfile.After, the user should be able to click a book title in the ListBox then click Compute Inventory to display the information below, which should be obtained from the textfile.

View 7 Replies

VS 2008 Arrays In A Drop Down?

Feb 21, 2010

I have been given an assignment which is to program a working payroll system in Visual Basic 2008.I have done most of it but I am stuck at the arrays.I would like my system to store all the staff name that the user adds on the system into a single Array for example in EmployeeNames(50). For example if the user enters a new staff in the textbox name and confirms it by clicking on a button, I would like that staff name to be stored into my Array EmployeeNames(50).

View 1 Replies

VS 2008 Combining Two Arrays?

Jul 3, 2009

I'm trying to combine two arrays. Simply append 1 array to another. I have two string arrays. Lets just say array1 and array2.would the following be correct?

array1.Copy(array1, array2, UBound(array1)) I guess I'm slightly confused about the parameters. When I try to use the above code I get green squigglies with the following error.Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

View 2 Replies







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