Create A Custom 2 Dimensional Array Datastructure/class?
Jun 21, 2010
I want to create a user defined data structure, which will be a 2 dimensional array such that each individual square of this 2-dimensional array will also store the score and the grades. ( Iam using VB.NET) More details:
for example: There is an 2 dimensional array with 3 columns and 2 rows, I want to fill each of the
(0,0);(0,1);(0,2) with their own score (Integer type) and grades (String Type).
And this is same for the rest of the squares i.e. (1,0);(1,1);(1,2) and (2,0);(2,1);(2,2)
After creating such custom data structure: "CustomArray", I should be able to create the instance of this custom data structure (which will be a class) and code something like this:
Dim objCustomArray as CustomArray
objCustomArray = New CustomArray
for i as Integer =0 to 3
[code]....
View 2 Replies
ADVERTISEMENT
Feb 20, 2010
I want to create a user defined data structure, which will be a 2 dimensional array such that each individual square of this 2-dimensional array will also store the score and the grades. ( Iam using VB.NET)
More details: for example: There is an 2 dimensional array with 3 columns and 2 rows, I want to fill each of the
[Code]...
View 2 Replies
Jan 31, 2011
I want to create a custom class that has inside an array of another custom class (see my code below) but when the programm runs is crashes. Why? What is the right expression???? Plz help I'm a newbie in VB.net.....
Public Class ctrarray
Public nameclass As String
Public ctrlindex(glvar_spaces) As ctrlindexclass
End Class
[code]....
View 6 Replies
Jul 14, 2010
i want to crate a hierarchical data structure same as XML, means parent, child, sub child... like that one using vb.net. so ho can i create that one?
View 2 Replies
Jun 29, 2011
I am trying to write a class library and I am getting the following error: "Value of type 'WorkMateLib.Login' cannot be converted to '1-dimensional array of WorkMateLib.Login'"
The code of the classes is as follows:
Public Class Logins
Public CurrentUser As Login()
Public Sub New()
[Code]......
View 1 Replies
Feb 12, 2010
I want to create a 2-dimensional Array for a List of five Names for males and another List of five Names for females.
And I want the list of names of males and that of females in a Text Box / List Box. This I couldn't do.
I know how to do this for a 1-Dimensional Array.
I give below what I tried.
Public
Class
Form1
[Code].....
View 6 Replies
Sep 7, 2010
How do I create a multi dimensional array in visual basic. For example I have a soccer team with players. Each player has an id, first name, last name, address, phone number. How would I represent this using a multi dimensional array?
View 1 Replies
Oct 13, 2010
I'm a beginner at programming so I'm going through the Clearly Visual Basic 2008 book. There is a problem that I'm doing called JM Sales Solution and I need to create a one dimensional array with the information given.
JM Sales employs 8 salespeople. The sales manager wants an application that allows him to enter a bonus rate. The application should use the rate, along with the 8 salespeople, in an array, to calculate each salesperson's bonus amount. The application should display each salesperson's number (1 through 8) and bonus amount. as well as the total bonus paid, in the interface.
I did the interface that's not a problem. My problem is the Create Report code. I had the program running and displaying but it didn't display all eight bonuses or the Bonus and Total Bonus paid at the end. I did some tweaking and now I can't even get it to run again. This is the code I'm currently on
[Code]...
View 4 Replies
May 30, 2012
I need to create a questionnaire with ten questions. The questions can be hard coded as labels. I will have a radio group box for each question, with options, Always, Usually, Sometimes, Seldom and Never. I will then need to store these values for each time that the questionnaire is answered, and another button that will show the question number and the answer count for each question up to that point in time e.g. [Code] I am also assuming I will have a button that when clicked, will identify the active radio button and add 1 to a counter? [Code]
View 13 Replies
Nov 3, 2011
I need to build an interface that allows the user to select a horse from a list. The horses are as follows: horse1, horse2, horse3 and horse4. The application should display the way the horse places with a 1 means the horse won, 2 indicates second place , 3 indicates third and 0 indicates the horse did not place. Application needs to display a summary of each horse's individual performance as well as the performances of the other horses. Table for keeping track of each horse is as follows:
5 races-how each placed
1 2 3 4 5
horse1 0 1 0 3 2
[Code]....
View 8 Replies
Feb 17, 2010
I have a string containing many lines. Each line has many values separated by commas. Basically it's in CSV format. The number of lines is variable but the number of columns is always 7.
I can get each line into a one dimensional array using Split(Var, Chr(10)).
I'd like to make it a two dimensional array where the second dimension contains each comma separated value.
I've got
Dim VarArray1() As String = Split(VarText, Chr(10))
Dim VaryArray2(0 To VarArray1.Length - 1, 0 To 6) As String
Is there a quick way to get the contents of VarArray1 into VarArray2. I know I can do the following.
For Counter = 0 to VarArray1.Length - 1
Dim line as string = VarArray1(Counter)
Dim Values() as string = Split(line, ",")
For Counter2 = 0 to 6
VarArray2(Counter,Counter2) = Values(Counter2)
Next Counter2
Next Counter
But is there a quicker way to do it that doesn't require passing through each element of VarArray1 and then passing through each element of Values.
The eventual goal in all of this will be to find the highest value in the 3rd column (the arrays are strings at this point because not all columns are numeric). To do that once I get the values into VarArray2 I suspect I have to pass through each element VarArray2, i.e. VarArray2(Counter,2). Unless I can copy the whole third column into a SortedList?
View 4 Replies
Feb 26, 2012
I have 9 1-dimensional arrays of bytes and 1 of them is empty, I want to make the empty one equal to the others put together like you would a string:
Dim bla As String = "bla" & "bla" & "bla"
'now bla = "blablabla"
but instead:
[Code]......
View 9 Replies
May 14, 2012
I have created a class "student" and made an array which contains students.I would not only like to display the array in a datagridview, but the array should also be updated if the user makes changes to one of the students in the datagridview.
I succeeded in showing the array in the dgv: one way is using datasource prop, the other is doing is diagrammatically. However, i can't find out how to let the user edit the array by editing the dgv.
View 1 Replies
Sep 30, 2009
I'm moving my first steps in the VB.NET world (I come from VB6) and I'm stuck with the creation of a particular class.
Let's say we have a bus that always has 101 places. I'm trying to create a class containing the map of the bus, along with methods to graphically represent it.
My "Bus" class will have a couple of properties ("BusColor", "BusModel") related to the whole bus. Then it should have a property called "Places" whose type is a custom class thet represents every single place, along with, for example, the passenger name or the place number. This property should of course be an array.
This is my code so far (simplified):
Public Class BusMap
Private Const MAX_PLACES As Integer = 101
Private _BusModel As String = ""
[Code]....
but I wonder if there is a more standard way of doing this.
My second question is: how can I modify my class to be able to iterate its Places property with the "for each" statement? A quick search on the web showed up that I should implement the IEnumerable interface, but I'm still not enough confident with the concept of Interfaces.
View 6 Replies
Jun 16, 2009
I've been programming in VB.net for a while off and on, but never really had a need to use custom classes till now.I built a function in a module to populate a class, The class how ever is supposed to refer to one instance.I need to create an array of this class but the amount of instances needed is not always known.Works fine till the class goes to populate the class array.[code]It's probably something simple, I've just starred at it to long. Keep gettitng "Object reference not set to an instance of an object."
View 1 Replies
May 14, 2012
I am working on a project which lets the user edit the students in a certain group using a datagrid. First I created a class called student and then I created a student-array. Displaying the students in a datagrid works fine. On form-load, I change the datagridview.datasource to the student-array. The datagrid has 20 rows by default (Public dbstudebt(0 To 19) As student). When I edit an existing student everything works fine but when I fill something in in an empty cell and press enter or tab to confirm and add a new student, it just clears the cell and nothing happens. So basically, editing existing studs in the datagrid works fine, making new student doesn't work at all as those cells are always cleared immediately.
View 4 Replies
Jan 5, 2010
I am trying to create a property of type string array (if this is possible).....and I seem to be lost.
I tried the following, but it says "String cannot be converted to '1-dimensional array of string'" at the return
Private _strZipList As String()
Public Property strZipList(ByVal i As Integer) As String()
Get
[Code].....
View 10 Replies
Nov 20, 2009
I use this code to create the same Button in multiple Forms[code]....
View 6 Replies
Jan 11, 2012
Declare Custom Events To Avoid Blocking, with more than one custom event. If I duplicate the Public Custom Event section and just change the event's name, then both events are called even if my code only calls one of them.
Public Class TestClass
Private EventHandlerList As New ArrayList
Private EventHandlerIndex As New ArrayList
[code]....
View 5 Replies
Feb 20, 2012
I have an SQL statement like:
SELECT FNAME, LNAME, CITY from EMPLOYEE
How do I create a multi-dimensional array from a datareader which should store values like:
John, Doe, LA
Mike, Johnson, PASADENA
Freddy, Kruger, Long Beach
View 3 Replies
Apr 15, 2012
I am making some changes to a fairly old project.It has a DataGrid with an Inherited Class
Public Class CustomDataGridTextBox
Inherits DataGridTextBoxColumn
and a Override Sub Protected Overloads Overrides Sub Paint (.......What it was doing was alternating the Data Grid Line colours New Requirement is to break up some items in the DataGrid By categories So I have added new lines to the data and sorted so they show up ad category headers (Production Stations) And they would like the Category Header to be a different colour and then the alternating line colours to restart.This did not sound too difficult but that has proven a trap Setting the category header is no problem but restarting the alternating colours is Previously the row was determined to be odd or even to set the colour.Now I am intending to use an Integer to define what colour is used but it persists only for that text box.
How can I get it to extend its life so each call can refer to it and update it and set the desired colour?All I need to do is have an integer variable that will hold its value for the next call?
View 11 Replies
Apr 29, 2011
I want to store additional information about a listview item using a custom class, but I can't seem to get it to work.I'm currently using this code to accomplish something similar using a listbox item.I just want to do the same thing with a listview.
Public Class myListboxItem
Public id As String
Public rootFolder As String[code]....
I forgot to add "Inherits ListViewItem" to my class.I'll update the code listed here to serve as an example for others.
View 1 Replies
Nov 29, 2011
Is it possible to create a user control with a list of custom class type property? If it is, how can I? The issue is that, in designer mode the property is not displayed in property window. I can add the list on markup but when i switch to the designer mode it gives an error which is 'The user control does not have a public property named BookList'.
View 1 Replies
Aug 12, 2009
I'm writing a ray tracing program that uses snell's law to trace rays through a system of lenses to examine abberations in a given design.I have a class called lens, which holds variables for example, name of the lens, description, number of elements.I want to be able to have a sub class or array within lens (or some other way to manage this data).I wont know what number of elements is until run time.
So I would need to define the array at run time.Part of the idea of my program is randomly generate lens elements within given rules (as in a massive lot), keep the top designs and continually refine them by making billions of micro adjustments to the variables that define the lens etc, which I can pick up later on as it'll save the database/variables.For example, say Lens(63).NumberOfElements = 6.
I want to be able to access Lens(63).Element(3).Radius1 Etc, there will be a bunch of variables under Element, such as Radius1, Radius2, refractive index, horizontal diameter, vertical diameter, and spacing between the next element if it isnt the first.
And Lens(70) may only have 4 elements etc. How can I define a different array size like that in the class under different parent array indexes at run time?
View 2 Replies
Feb 9, 2010
I am having a problem understanding the following error message:
Value of type 1-dimensional array of string cannont be converted to 2-dimensional array of string because the array types have different numbers of dimensions This line seems to be causing the error:
New String((13) - 1) {}
I did a Google search on this but didnt come up with anything useful. I didnt even change the code.I just found this example online and copied/pasted it into a project that Im working on.
All code is listed below!
Calendar.aspx.vb
Imports System
Imports System.Data
[Code].....
View 4 Replies
Oct 6, 2010
I need to create an array of a class type. Populate the values in the class and then pass the array to a subroutine. I havent figured out how to do this properly as I get a null reference exception. Can someone show me how to create/instantiate the array of objects? Here is a simple example with only one property named "_momentum". My actuall class has about 10 properties/variables in actuality
[Code]...
View 3 Replies
Oct 9, 2006
How do I creat a simple array of class definitions?[code]...
View 13 Replies
Aug 25, 2010
I need to append STRINg to Array and cast it 1-dimensionalArray
Dim remoteFileNames(0)
As
String
[Code]....
Here "FtpRemoteDirectory" is a string and ftpFileNames() is the Array String which list the FileNames.
and remoteFileNames is 1-dimension array
View 1 Replies
Apr 18, 2011
I've a treeview in my project form which look like this.
-Cover Page
-Video1
-Podcast1[code].....
The user will be able to upload their pages to the respective pages nodes and I am suppose to make it in such a way that after the user uploaded the cover page which is showing at the PictureBox1 which I've use to display the image, and when he uploads the second page image at the PictureBox1, the Cover page image that he uploaded earlier on will not be overwrite.
I was told to create class and use array to store the contain in the respective nodes but I do not have any idea how to do it.
View 2 Replies
Feb 3, 2010
I am new in this forum, also new in VB.Net I need to create a public class for insert and delete data to database Public Class My_DBFunctions
[Code]...
View 1 Replies