Make Two Dimensional Arrays?
Nov 19, 2011Dim Paper As Graphics
Paper = picBox.CreateGraphics()
Paper.Clear(Color.White)
[code].....
Dim Paper As Graphics
Paper = picBox.CreateGraphics()
Paper.Clear(Color.White)
[code].....
I am trying to set up a number of two dimensional arrays that will be accessed from several forms in the project. I have set up a module to declare all public variables.When I declare the array (Using variables to determine the size of each dimension), when I go to run it, I get an out of index error.If I declare it them as public variables within the form, I don't get the error but then the input cannot be accessed from other forms.Am I completing incorrectly in the module or is there something else I ought to be doing.
The code within the form is
Dim Boardresult(NumBoards, Numteams) As Integer
Dim compass(NumBoards, Numteams) As Boolean
Where NumBoards and Numteams have been input and stored previously.
I have two one-dimensional arrays filled with dates. I want to join them into one array.
View 3 RepliesI have the read the article "Creating Control Arrays in Visual Basic .NET" (link: [URL]) and I its very good and useful code for 1D array of objects. What if someone wants to make a 2D array of control objects. For example creating a "table" of 8x8 buttons that will be able to change properties by using the arrays x-y coordinates. Something like button(x,y). backcolor.black or similar.
View 3 RepliesIve currently got this:
Public Class World
Dim StringA() As String
Property SetString() As String()
Get
[code]....
I need StringA to be a Two-Dimensional Array. I've played around with it and was unable to figure it out..
I have the followig problem; i want to make a class with a private field as a 2-dimensional array, where it's dimension is set in the constructor of the class.Contained data does not matter at this moment.I've looked a bit around but couldn't find a direct solution to my problem, is this possible in VB.NET? [code]
View 2 RepliesI have two different 2-dimensional arrays. I assume the setting i need to save them to is a string setting, as is the cast with regular integer arrays. The first 2-d array I need to save is an integer, the second a decimal.
Let's say the settings are called my.settings.2darray1 and my.settings.2darray2
Let's also say the arrays are:
vb
dim 2darray1(50, 99) as integer dim 2darray2(50, 99) as decimal
What would the code be to load each array and save each array?
is it possible to sort Multi-dimensional Arrays? If the answer is yes could someone help me giving some hints on how to start?
View 6 RepliesI have a string, which can easily be splitted by seperators into an array.The output has to be splitted again an move into a multi-dimensional array (2nd index)[code]
View 2 RepliesI am new to VB, trying to create a tic-tac-toe game but none of the tic-tac-toe tutorials use 2 dimensional arrays. Since tic-tac toe is 3x3 I created 9 buttons and want either an X or an O to appear depending on where the user clicks. I want one set of instructions to handle the multiple buttons. I was told to use Case statements.
This is what I have so far. Not sure how much is right but hopefully it gives you an idea of what I am looking for.
[Code]...
I am having difficulties grasping the concept / context of two dimensional arrays. For the assignment I am working on I am required to use radio buttons to allow a user to vote if they like or dislike an item from a combo box. The contents of the combo box have been populated through the IDE via tht item property.I understand how to set up my rows and columns, which will be, (0 to 4), (0 to 1). The trouble I am having is how to record and display the votes and have them correspond to the selected item from the combo box. Can anyone give me an example of how something like this works?
View 9 Repliesok so im having issues with this
Select Case a(b, 3)
Case "d"
c = 0
[Code]....
OK so a(b, 3) has either the letter d,e or f in it but when I try and read the multi dimensional array I don't think it picks anything up
I have a very simple 2D array, it holds a list of song titles, their genre, and their runtime. frmMain loads the array from a text file and allows me to manipulate it and boil it down to a desired (implicitly sized) playlist. i want to THEN pass that playlist array to a second form, frmPlaylist The problem i'm running into....When frmPLaylist calls the Property from frmMain I receive an error that VB cannot convert the string value to a two dimensional array. Simplified...frmPlaylist is all locked and ready to receive a 2D array, but frmMain seems to only be sending a single string variable. on frmMain
Public ReadOnly Property PlaylistOut() As String
Get
Return mstrTimedPlaylist(,)
[code].....
[code]...
Expected Results: A scalar result of the comparison between Array1 and Array2 such that when Array1>Array2 it is true. See expected array above.
Actual Results: When Result(x) is true, all elements become Array1(x) and Array2(x) .What is wrong with the function?
I have written a class for my one dimensional array The idea is to collect user information, put the info into an array and accumulate the value of each item of the array so there is a running total. The problem is that the code is not totalling the array when my btnSum is clicked or maybe at all. I am getting no errors, but I am also getting no total.
[Code]...
The exercise prior to this one had us use two parallel arrays that store a letter grade (A, B, C, D, F) and the minimum points needed for each grade. The user input the points earned by the student and the program shows their letter grade. It took a minute, but I got that one done, and it does what it's supposed to do.This exercise has us modify that exercise to ask for the (via InputBox in MainForm Load event) total points possible. The grade is then determined by percentage of the total points possible. For instance, if x is the user input, an "A" would be 90% of x.
View 4 RepliesI am doing in my Visual Basic Reloaded:second edition school book. Ok here is all the information the case problem gives me and what it wants me to do.JM Sales employs 10 salespeople. The sales made by the salespeople during the months of January,February, and March are shown in Figure 8.52. The sales manager wants an application that allows him to enter the current bonus rate. The application should display each salesperson's number (1 through 10), total sales ammount, and total bonus ammount. It also should display the total bonus paid to all salespeople. Be sure to use one or more array in the application.Then it gives you a table with the salespersons 1-10 sales amount january February and March.(this is the figure 8.52)Here is a duplicate table of it below.
Salesperson January February March
----------- ------- -------- -------
1 2400 3500 2000
2 1500 7000 1000
3 600 450 21
I have this code to set array values and store them in a variable,
Dim productName As String()
Dim productPrice As String()
Dim productCategory As String()
[CODE]...
How do you get the variable values to output like this?
<input type="text" value="Chang Beverages $19.00" id="Chang" /><br />
<input type="text" value="Ipoh Coffee Beverages $46.00" id="Ipoh Coffee" /><br />
<input type="text" value="Gula Malacca Condiments $19.45" id="Gula Malacca" /><br />
i am a beginner learning vb.net. I have an excercise to create a form and on clicking the totals buttons it should display the number of employees who have earnt a salary within the ranges below. Now this code works, but i want to substitute the Select Case Statement with a more efficient for..next statment to increment my counter. The code is:
[Code]....
i want to make a vb.net program that reads from a text file a movie, with the help of a Open Dialog (called openFD in my program) (we don't know how many movie we've got), the actors, the release date, the country, and the rating.
The text file look like this:
Movie1;Actor,Actor,Actor1;Date1;Country1;Rating1
Movie1;Actor,Actor,Actor1;Date2;Country2;Rating2
...
First question: How can I make a 2-dimensional array? line(0,0) - Movie1, ... , line (1,5) - Rating2. Here Is my try, but it's not good:
Dim line As ArrayList = New ArrayList()
Dim itm As ArrayList = New ArrayList()
Dim i As Integer = 0
[code]....
And here is the code for the Delete Button. It deletes a movie from the listbox, but the details of the deleted movie remains for the next one, I must delete the details for the deleted movie, too.
ListBox1.Items.Remove(ListBox1.SelectedItem.ToString)
Im preparing a program for my teacher friends using vb 2010 express. They keep records about their students. I prepared a database that contains a table named "Mystudents". It has columns like "studentId , Name, Surname, etc.." . My problem starts here. Each student attends lots of lessons during a year. I must keep "which lessons they attended", "when they attended", "which topic done in the lessons" for each students. for example
Id: 104
Name : Jason
Surname : Black
Class : 10A
[Code]....
i mean i have a list of data for each record of databese.
how to make an array of buttons in vb .net 2005. It seems very different in vb6 'coz in vb6 you have just to add an index on its property but in vb.net there is no index property. Can it be made by designing in on the form just like copying and pasting on the form in vb6?
View 2 RepliesHow can I make a highscore page with 2 arrays that store a name and a score. I want my highscore page to have thier name and score but also only have 10 high scores with highest to lowest. Also it must save so anyone that plays will see it.
View 3 RepliesThis probably sounds daft, but im struggling to get to grips with Classes/Modules/arrays and objects, as well as there uses and what they are, and yes im still coding some how i hear you cry.The reason i ask is because Ive got a load of Dim's in my program that are the same giving locations of files and folders and wondered can they be used as a module that i can alter after the program is built, incase of folder locations being wrong or moved, manually correct after install.
View 1 Repliesim trying to make picture boxes as arraybox(0)box(1)ecti want it to be an array so i can make infinite of them
View 15 RepliesPass a 2-dimensional to a 1-dimensional function
View 5 RepliesIn many projects I work on, whenever I have to return a read only collection, I use the IEnumerable<T> interface and make it type specific like so:
CODE:
Most of the time, I return a List but in some functions and read only properties I return an array which also serves the purpose alright by kind courtesy of Extension Methods.
My question is am I violating any design principles by returning IEnumerable<T>s instead of specific types (e.g.: List<T>, HashSet<T>, Stack<T> or Arrays)?
I have to make a program that uses 2 arrays, one with the states name and one with the capitals names. I have to make it to where it randomly selects a state and asks you what the capital is, and gives you 4 choices in the 4 radio buttons provided. My problem is getting one of the randomly selected answer choices to be the Correct answer.
Here is my code so far:
Public Class USCapitals
' Declare module level variables.
[Code] .....
I need to make basically a bunch of 2d arrays, that I can access the independant values easily. Like multiple properties As an example:
[code]...
Because later I have to access Value1 in a manner that spells out each independantly. I have used some basic Structures to define 1 property and does something with it. But not 2 properties, and I am out of my norm on creating a Class to do something like this.
trying to make a Multiple Choice quiz, with 20 questions
-4 RadioButtons
-2 Label (Reading the Questions) and 1, keeping a score count
Do I wanna make some arrays like Questions(20) and Answers(20)
Dim ScoreCount as Integer
So I want it to be a little screen, and once you click a Radiobutton to choose answer, it will change the label to Question(2) so forth.. but I am unsure how to do this. I am fairly new to vb, im doing this to learn.How do I make it so everytime you click a radiobutton wether it's right or wrong, the next question and possible answers all change??