Seaching An Array - Store In A 1d Array A Set Of 5 Place Names And In 2d Array The Distances Between Places

Jul 28, 2010

I am trying to create the following program Store in a 1d array a set of 5 place names and in a 2d array the distances between the places. Ensure that the order of the places is the same in both arrays. When the names are places are input the distance between them is displayed. If they are not both in the table a suitable message is displayed

Dim town(1 To 5) As String

Dim Dist(1 To 5, 1 To 5) As Integer

Dim First As Integer

[CODE]......................

I think the best way forward is pass a parameter to the function findnumber.

View 1 Replies


ADVERTISEMENT

Store & Display Names In An Array

Mar 15, 2012

In the following code (Class & Form1), I'm trying to figure out the following:

- Create an array that stores the 'Clients' (first name, last name, account number)
- 'Button List' the array with the (First Name , Last Name , Array Value , Account Balance) [code]

View 4 Replies

Array Of File Names And An Array Of Files In Directory

Jun 8, 2009

I have an array of filenames, and an array of files in a directory. I use a for loop in a for loop to check if those files are in that directory. Look at the below code to illustrate my problem. [code]

View 8 Replies

Generic Class Array - Reading In A Excel File And Extract Data To Store In A Array

Sep 9, 2010

I want to reading in a excel file and extract the sCodenumber sDescription ans the sStatus and store them in a array : StatusComposeArray(5200) As MyCompose. After this I need this array for comparing outside this class. But as can you see the array is defined inside the sub: ReadingIn_ExcelFilesCompose [Code]

View 2 Replies

VS 2010 : Copy This Array To A Temp Array So That The Temp Array Has All The Same Values As The Original Custom Array?

Jun 19, 2011

I have an array of people stored in a custom structure array... how can i copy this array to a temp array so that the temp array has all the same values as the original custom array?

View 4 Replies

Take Recorded Coordinates (x,y) And Place Them Into An Array?

Jul 22, 2011

How can I take recorded coordinates (x,y) and place them into an array? I have the variables set up and everything, but I am unsure how to declare the array for this purpose and how to take what I have in the array and graph the coordinates later on.

Here is the relevant

vb.net
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = TextBox1.Text + 1

[Code].....

View 9 Replies

How To Make And Place PictureBoxes On Screen With Array

Oct 17, 2010

How to place units and their men on the form but I cant seem to get this array to work. It has multiple errors in it.

Dim pic(calctroops()) As New PictureBox
Dim z As Integer = 15
For i = 0 To Form3.orcunits
For x = 1 To Form3.orc(orcunits)
z = z + 15
pic(i).Location = New Point(Orc1.x + z, Orc1.y)
pic(i).BackColor = Color.Green
Me.Controls.Add(pic(i))
Next x
Next i

View 2 Replies

Multiply Every Member Of An Array By Some Number In-place?

Feb 23, 2010

Is there a built-in way to multiply every member of an array by some number in-place?

Example:

Dim volts () as Double = {1.243, 0.534, 5.343, 2.223, 4.334}
Dim millivolts (4) as Double = volts.MultiplyEachBy(1000) 'something like this

View 2 Replies

Array With Object Names

Jan 30, 2010

I'm having problems regarding using arrays on object names. for example, i have a textbox named txtBox1.text and a array declared as a(2). I what to transfer the value of the textbox to the array using loop.[code]

View 2 Replies

Get Files Names Into Array?

Oct 31, 2009

What i'm trying to do is to open a dialog box which from there i will be able to select files and their names will go into an array.

View 7 Replies

How To Store Value In Array

Apr 13, 2011

I want to store value in array, from my database. I am using following code but it return error: "Object reference not set to an instance of an object."[code...]

View 2 Replies

Place Dynamically Generated Objects In An Array (or Collection)?

Apr 11, 2011

I created a custom class for a custom object. I instantiate like so[code]...

Now, I have two problems. First, right now this is just overwriting the same object properties, again, and again. I need to somehow dynamically name the object. Then, I need to place these objects in an array so I can iterate through them...

View 1 Replies

Extracting Array Names From A String?

Mar 5, 2012

I m trying to write a program that is mostly dynamic. This program enables the user to read in several inputs (temperature, pressure .) and perform calculations on those inputs. After that the program sends an integer to an analogue output port. The program automatically determines the number and type of the inputs. It also creates something called a variable handle for each input.This is then saved to an array input_handler(0,x). That array is sized this way input_handler(0 to 1 , 0 to 9)

0= handle (integer)
1= value (integer)

The program dynamically creates a button for every input. There also is a button for every mathematical operator. This way the user can create a function by pressing buttons.This function will be saved to a string. That string will look something like this input_handler(1,0)+ input_handler(1,4)/ input_handler(1,3)Well now Im stuck with a string and VB will obviously just print out that string instead of calculating anything. Is there any conversion I can perform so that string becomes the actual array values?

View 8 Replies

VS 2008 Add An Array On Names In A List Box?

Jun 28, 2010

How can i add an array on names in a list box And be able to add and delet name in a listbox ps sence i just fond out .net cant mke control array ill use listbox with an array of names in it

View 2 Replies

VS 2010 Array Of Control Names?

Jul 8, 2010

In one program i'm making, I have a little problem.In this application I have 25 button, wich I must have enable or disable everytime.How can I sned a part of name of the button? For example, if I have one array with the values:[bt1, bt2, bt3, bt4, bt5....] witch is the name of each control.Is possible someting similar this? :

array(1).enabled=true
button & array(2).enabled=true
etc...

View 8 Replies

An Array Of Objects - An Entry Will Be Stored In Serialports(4), All Other Array Elements Will Be Blank?

Jun 1, 2009

I've come up with the following and it's partly working.

Public serial1, serial2, serial3, serial4, serial5 As SerialPort
Public serialports() As Object = New Object() {serial1, serial2, serial3, serial4, serial5}
dComPort = "COM4"[code]....

The above code works fine! But im having trouble trying to now retreive whats stored in the array.In the above example, an entry will be stored in serialports(4), all other array elements will be blank.If I do this it works.

MsgBox(serialports(4).PortName) ' this retuns the value COM4

But I'd like to loop though all array elements and print out ALL the PortNames, The below code doesnt work, I get an error Object variable or With block variable not set.

For i = 0 To serialports.Length - 1
MsgBox(serialports(i).portname)
Next

View 3 Replies

Array.Sort Returns Blank Data When Sorting A Structure Array?

Jun 19, 2009

I'm trying to sort an array based on a structure but whenever I do this, it basically erases all the data in the entire array.I have verified that the array is populated correctly, it is when using array.sort that everything returns blank.

View 6 Replies

Initialize An Indefinite (eg. Decimal) Array Without Setting Boundaries On The Array Length?

Nov 10, 2009

initialize an indefinite (eg. Decimal) array without setting boundaries on the array length?

View 2 Replies

Object Array To Byte Array - Marshal.AllocHGlobal Fragmentation Query?

Jun 14, 2011

I didn't think it fair to post a comment on Fredrik Mörk's answer in this 2 year old post, so I thought I'd just ask it as a new question instead..NB: This is not a critiscm of the answer in any way, I'm simply trying to understand this all before delving into memory management / the marshal class.

In that answer, the function GetByteArray allocates memory to each object within the given array, within a loop.Would the GetByteArray function on the aforementioned post have benefited at all from allocating memory for the total size of the provided array:

Dim arrayBufferPtr = Marshal.AllocHGlobal(Marshal.SizeOf(<arrayElement>) * <array>.Count)

I just wonder if allocating the memory, as shown in the answer, causes any kind of fragmentation? Assuming there may be fragmentation, would there be much of an impact to be concerned with? Would allocating the memory in the way I've shown force you to call IntPtr.ToInt## to obtain pointer offsets from the overall allocation pointer, and therefore force you to check the underlying architecture to ensure the correct method is used*1 or is there a better way? (ToInt32/ToInt64 depending on x86/64?)

*1 I read elsewhere that calling the wrong IntPtr.ToInt## will cause overflow exceptions. What I mean by that statement is would I use:

Dim anOffsetPtr As New IntPtr(arrayBufferPtr.ToInt## + (loopIndex * <arrayElementSize>))

I've read through a few articles on the VB.Net Marshal class and memory allocation; listed below, but if you know fo any other good articles I'm all ears![URL]..

View 1 Replies

Obtain Index From Array Where An Input Value Lies Within A Range Of Values In The Array?

Dec 12, 2010

Per this UserControl that can be added to a blank form, I would like to use the HorizUnits array below to map custom grid x coordinate from a mouse x position.For a given input value 13, what syntax would I use to obtain a value of 2 where 13 lies between Value 10 and 16 for which 2 (Name) would be the custom grid's displayed coordinate position?

View 1 Replies

Perform A Sum Of Individual Column Of 2d Array And Send The Result To 2d Or 1d Array Or Datagridview?

Mar 12, 2012

I have a 2d array of data that I have performed the sum of the individual column of the 2d array. I want to send the results to a datagridview and also will like to have the result as a 1d or 2d array.

Below is sample of my code

Dim Array1(,) as double
Array1(0, 0) = 5
Array1(0, 1) = 7

[code].....

View 4 Replies

VS 2008 Binary Serialization - Save An Array Into My .bin File Then Read The Array Again

Nov 27, 2009

Can I save an array into my .bin file then read the array again just like a string or Integer??

View 2 Replies

Null Reference Exception Unhandled Error When Input Is Saved Into Array After Array Has Been Erased?

Jun 23, 2011

n my project i am to enter a name and a test mark into two separate text boxes and then select the button to store the information into the arrays, one array for names and another for marks, but when it is reset using the Erase <Array> fuction andi try to re enter information, no matter what information is entered i get a "Null Reference Exception Unhandled" Error.I am using Visual Basic 2008.My code is as it says from now:

Public Class frmAdverageTestMarkCalculator
Dim ClosingMsg As String
Dim Closingtitle As String

[code].....

View 7 Replies

Array Calculation - Unable To Calculate The Values Coming From The Array ?

Dec 7, 2010

I am writing a pizza order program for class and have gotten everything put together, even got my array setup and displaying but when i go to calculate it will not calculate the values coming from the array in any of the calculations.

[highlight="vb"]Option Strict On Public Class Form1 'declare structure and module-level variables Structure PizzaSale Dim SizaString As String Dim StyleString As Stri]

View 3 Replies

.net - Array.Sort() Doesn't Correctly Order Target Array

Apr 13, 2012

I'm using the following code to read in a highscores file with the score written first and the player's name written to the next line, and then display the top 3 scores or fewer if there aren't 3 scores written to the file. A highscores display should have the scores sorted with the highest first so that's what this program tries to implement.

Array.sort() isn't doing a damn thing. In fact, the program's not even reversing the arrays like it should either. I've tested array.sort() this way with the names and scores arrays given explicitly and it works fine. I thought maybe it was still reading the data as string even though it's declared otherwise but it rounds off decimals when I change the array type to Integer so I'm pretty sure it's not that.

I have no idea why reading the data in from a file changes how it's sorted. My teacher didn't understand what was going on either. Does anyone know what's going on here?

Imports System.IO
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code].....

View 1 Replies

.net - Combining Array Of Arrays Into Single, Distinct Array Using LINQ

Apr 19, 2011

Can this be rewritten any better using LINQ? I'm a C#er trying to think in VB.NET for this current project. It's in an ASP.NET Web Forms .vb codebehind:

Public ReadOnly Property AllowedCategoryIds As Integer()
Get
Dim ids = New List(Of Integer)

[Code]....

View 1 Replies

Compare Two Array And Save The Miss Match Character Into 3rd Array?

Apr 9, 2010

I want to compare two array and save the miss match character into 3rd array.

View 1 Replies

Convert C# Class's Byte Array Values Into Integer Array?

Jun 22, 2010

A c# class's single dimension byte array contains socket level instrument sensor data as per:

public static byte[] frameData

View 9 Replies

Creating An Array From A CSV Text File And Selecting Certain Parts Of The Array?

Mar 20, 2011

I have a Comma Separated value file in .txt format... simply put, its a bunch of data delimited by commas and text qualifier is separated with ""For example:

"So and so","1234","Blah Blah", "Foo","Bar","","","",""
"foofoo","barbar","etc.."

Where ever there is a carriage return it signifies a new row and every comma separates a new column from another.My next step is to go into VB.net and create an array using these values and having the commas serve as the delimeter and somehow making the array into a table where the text files' format matches the array After that array has been created, I need to select only certain parts of that array and store the value into a variable for later use.... how to make the array and selecting the certain info out of it..

View 1 Replies

Merge Array Of Elements Into Larger Array When Element Order Is Different?

Nov 23, 2010

Assume I have an array myArray1 = { A, B, C, D, E, F, ., T}I have another that contains a subset of the elements of myArray1 but where the order may vary

View 3 Replies







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