Writing Data From Array In One Class To A Listbox In Another Class
Jul 26, 2011
I'm designing a small GUI Windows program that allow staff at a cinema to reserve seats for customers. There will be a total of 60 seats in the cinema. I have two classes in my program:-
1.) MainForm.vb - used for I/O actions and user interaction
2.) SeatManager.vb - used to hold and handle the background methods and functions that make the program work
Here is the code for my MainForm.vb class thusfar:-
Public Class MainForm
Private Const m_totalNumberOfSeats As Integer = 60
Private m_seatManager As SeatManager
[Code]....
Basically, when the program opens, the lstReservations list in the MainForm class will be populated with a total of 60 (m_totalNumberOfSeats) entries to represent 60 seats. Each of these seats will contain the index number from the array m_nameList; this index number (+1) will represent the seat number and then in the lstReservations list, after the seat number, I'd like it to contain the respective entry from the m_nameList array. As all entries will be held in RAM, when the GUI is opened, all m_nameList array entries will be empty. As the user uses the program, they can highlight a row in the lstReservations list and then use the GUI textboxes to enter the customer's name which will then be populated into the respective array entry.
how to, when the GUI opens, ensure that the lstReservations list takes all of the blank entries from the m_nameList array and from there, I can highlight a row to carry out further methods on?
View 1 Replies
ADVERTISEMENT
Jun 3, 2011
I'm designing a small GUI Windows program that allow staff at a cinema to reserve seats for customers. There will be a total of 60 seats in the cinema. I have two classes in my program:-
1.) MainForm.vb - used for I/O actions and user interaction
2.) SeatManager.vb - used to hold and handle the background methods and functions that make the program work Here is the code for my MainForm.vb class thusfar:-
[Code]...
View 5 Replies
May 15, 2012
I�m currently working on a school project and I have encountered a problem in my code. When i write the contents of my listbox to a file called stock.txt it seems write an invisible linebreak in-between each data entry, my problem is that when I load my array on the next form those invisible linebreaks causes my array to load the data incorrectly.
I have attached a pic of my stock.txt file
The Code that Edits and writes to stock.txt
Private Sub BtnRemove_Click(sender As System.Object, e As System.EventArgs) Handles BtnRemove.Click
'Removes the selected item from the listbox then updates stock.txt
lbxStock.Items.Remove(lbxStock.Text)[code].....
View 6 Replies
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
Jun 21, 2010
I am trying to create an list or an array of a class.Here is my "Ingredient" class that I am trying to create a list of:[code]In my "recipe" class, I am want to create a list (or array) and I am drawing a big blank on how to do it. Can anyone point me in the right direction?
View 2 Replies
Nov 3, 2011
I have main class of Races with mulitple properties. One of those properties has been defined as another class Runners.
So I have a race with multiple runners and when I try to update the data i get an instantiation error.
For the life of me I can't get it to work.
This is what I am trying to do...
In the clsRace class I have defined :
PublicProperty clsRunner(ByVal index AsLong) As clsRunner
Get
[Code].....
View 4 Replies
Feb 28, 2012
I am New to <acronym title="Visual Basic">Vb</acronym>.Net. this is my first test. i try to create small address book. but i don't know what wrong. it compile perfect but when it run it give error and not work. is there any other way to add same class like in class inside array?
[Code]...
View 6 Replies
May 3, 2009
I declared made an array of my class like this
Dim
myClass(3) As Class1
Now when I try to enter data like this:
myClass(0).s = ("Test")
I get an error "Object reference not set to an instance of an object."
View 3 Replies
Jul 28, 2010
I have two classes, and for a property in one of the classes I'd like to be able to load it up with an array of the other class. However my attempt at accomplishing this results in a "Object reference not set to an instance of an object" error. I know it's a rookie mistake, but I'm stumpedssist?
My code is as follows:
Namespace Parking
Public Class garage
[code]......
View 2 Replies
Aug 6, 2011
I want to include Arrary of Class in a class. For Example
Public Class AddressSet
Private addressValue As String
Private effectiveDateValue As Date
[code]....
my goal is let the user add address maximum 10 addresses under one name How do I implement "Property" to have array AddressSet using array index?.
View 9 Replies
May 8, 2012
In short, I can't seem to get the xml serializer to serialize an array of one class type embedded within an array of another class.I have two classes, one of which contains an array of the other class, as follows (there are other objects in the classes that I've not included):
[Code]...
There must be a simple way to get the XML serializer to serialize the array of the class embedded within the array of the class that I am serializing. Am I missing something?
View 5 Replies
Dec 16, 2009
If Class X is within the scope of Class Y, is X a subclass of Y?If Class A is a sub Class of B, then is Class B considered a super class of A?if Class C inherits Class D is Class D a superclass or parent of Class C?if Class E extends Class F then we can consider Class E a child of F?if Class G inherits Class H and is within the scope of Class I then who is the parent of Class G? Classes that inherits Class J and classes that are within Class J are all sub classes of Class J?
View 1 Replies
Apr 15, 2010
I have put this code in the global form Inherits System.Windows.Forms.Form. And then in the form that will inherit this from the global Inherits MenuStrip. "MenuStrip" is what the global form is called. But keep getting this error: Error1Base class 'MenuStrip' specified for class 'Lesson2' cannot be different from the base class 'System.Windows.Forms.Form' of one of its other partial types.
View 5 Replies
Jul 22, 2011
I have a class (see below)
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Public Class ClientProfile
#Region "Variables"
[CODE]...
It is in the file ClientProfile I have placed in both App_Code and also App_Code/Models
In my code behind I have the following
[CODE]...
The last word, "ClientProfile" has the scary squiggly red line below it. It is not recognizing my class.Even the Intellisense is not picking up te class. Do I have to register the class file in any way?
View 4 Replies
Jan 20, 2009
It's been a LONG time since I messed with VB, and I'm messing around with VB 2008 now.I'm trying to make a custom class with three variables,
ID (String)
Title (String)
Comments (Array of String)
[code]......
View 3 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
Apr 9, 2012
OK, so its many years since I last did anything with VB5 and I now have a requirement to write code in VB2010uld like to put together a proof of concept for a project I am involved in.A lot of our coding exists as VBScript, but I need to add some functionality that VBScript does not offer, and the obvious path is to create a .NET DLL that can be called from VBscript. What I want to be able to demonstrate is the ability to edit a hex character at offset 15 from the beginning in a file not exceeding 2000 bytes. The filename of the target file will be passed from VBScript.
So from a vbscript perspective I would be coding something like:
dim‚myObj, filepath, decval, offset
filepath = "c: emp estfile.bin"
[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
Jan 23, 2011
OK I am as green as they come and just want to write a simple app that when it starts loads data into a few fields from the previous use.
I am thinking of using an XML file written to disk to hold this info, (I am open to any suggestions how to do this as simple as possible)
so I am going through the "Wrox VB2010 for beginners" and entering the code to create a class and apparently the compiler doesnt like something about saving stream as a string: It says "Value of type 'System.IO.FileStream' cannot be converted to 'String"
Imports System.IO
Imports System.Xml.Serialization
Public Class sdata
[Code]....
View 6 Replies
Dec 8, 2009
AdamSpeight2008, on 19 Jul, 2008 - 10:50 AM, said:Labels You have a label on a form and If you're using Label1.Caption = "Text for label" it's VB6 If you're using Label1.Text= "Text for label" it's VB.Net Buttons You have a button on a form. To set the text on the button.You're using Button.Caption= "Text on button" it's VB6 You're using Button.Text="Text on button" it's VB.Net
View 2 Replies
Oct 26, 2010
I have an issue with StreamWriter class. Basically, in an application running as a web service, I need to write info into a log file. When I send 2 web service calls simultaneously, the entries created in the log file are not correctly written. For example,
in call #1, ID 1 - xyz is to be written to the log file. In call #2, ID 2 - abc is to be written. When I viewed the log, it shows ID 1 - xyz & ID 1- abc. Looks like there's some memory data being shared and mixed together, even though it's totally 2 separate web service calls. From my understanding, each call (i.e. each will be process under a different application instance) should have its own set of memory allocation for data processing... If I am to make this application as a Console Application, it looks like everything is processed correctly.
View 3 Replies
Mar 24, 2010
I'm not sure I used the right lingo in the subject header. But, here's what I want to do. Let's say I have a class with some variables:
Class XYZ
Public InfoNo1 As Integer
Public InfoStr1 As String = " ".PadRight(200) 'Hahaha
Public InfoStr2 As String = " ".PadRight(100)
End Class
I've been looking around for examples of writing methods that act on variables defined within the class. What I want to do is make it so that doing something like this:
[Code]...
I don't need to know how to write the method, I think I can do that. I need to now how to make the method cause a ".Fixed" option to be added to the class string variables so that assigning a string using that method will cause the variable itself to be equal to the string plus the padding.
View 39 Replies
Sep 11, 2009
Dim a as Type=GetType(className) would gimme the type. But I have only the name of the class as string. I want something like GetType("class1") which would return the type.
View 2 Replies
Jun 28, 2010
I am trying to minimize my code writing. I have DBLayer base class that selects, inserts, updates and deletes records from database. I need only fieldlist and table name from each derived classes to perform the actions. I have defined static tablename, fieldnames in derived class. Currently I am defining next static functions in derived class for GeneralSelect [which selects all records], GeneralInsert[Which inserts a records], GeneralUpdate[Which updates records as per given id] and GeneralDelete[Which deletes a record of the given id]. The parameter and all functioning are same just the differece is the table name and fieldnames.
One DBLayer Class that performs database actions
Class DBLayer
Public shared function Query(byval SQL as string) as dataTable
[code]....
... same goes for all other table objects... If I have 20 database tables i have to write getdata method in all 20 class changing only the tablename so i would like to get ride of it. So in order to get ride of it what do i need to do?
View 1 Replies
Mar 29, 2010
I need to create an HTML email that consists of four tables. My idea is to create four different datareader or datatables and pass them to a class that converts them to HTML. Please help me get started.I've done this before by creating a stringbuilder then appending text to it and then sending it as an html email. but, now I want to build a class so I don't have to do it the long way all the time?
View 2 Replies
Dec 30, 2009
I am writing the code as on if statement that if the html class has strings called "<a id=""rowTitle1""(.*?)</a>" then do something. In what property that come after pattern that I could check the string whether if it valid or not??
View 13 Replies
May 15, 2009
I can't make difference between public class and private class and friend and protected friend class.
View 1 Replies
Jan 21, 2010
I can do this without problem.
Class A
End Class
Class B : Inherit A
End Class
Dim Obj1 As A = New B
View 4 Replies
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
Mar 12, 2010
What is the difference between using the 'array' class in VB and just declaring an array like normal. In other words, what is the difference between:
Dim numOfTicketsPerDay As Array
Dim intNumOfTicketsPerDay(6)
As Integer
Is there any preference of when one should be used over another?
View 2 Replies