Creating An Array Of Class2 Inside Class1?

Dec 15, 2009

Creating an array of Class2 inside Class1?

View 1 Replies


ADVERTISEMENT

Calling Method In Class2 From Class1?

Aug 9, 2009

Lets say I have a application with these three items:
A startup form called form1
A class lets say Class1
A class lets say Class2

How can I access a method in class2 from within class1? For example in Class2 I have a method call AddToDatabase(sql as string) and in a method is Class1 I have a SQL statement that I want to implement.

Solution that didn't work: Initializing an instance of Class2 in form1 called myClass2 and trying to reach it using: form1.myClass2Initializing an instance of Class2 in New subrotine of Class1 and trying to call it through: myClass2

View 7 Replies

Class Which Contains An Array Of Objects Of Type "Class2"

Aug 16, 2010

1 Partial Class _Default
2 Inherits System.Web.UI.Page
3 Public Function Ohjoy(ByVal X As Integer) As Integer

[Code].....

View 1 Replies

Copying Contents Of Object Of Type Class1 To Another Object Of Type Class1

Jan 12, 2010

I have a class named State that stores a lot of data regarding the current state (status) of the program (like the user's name, has he saved his work, last color he was using, etc). Before I allow the user to reset the state of the program, I want to backup the entire contents of State in case the user changes his mind and wants to undo things back to the way they were. I'm not looking for a complete undo algorithm, just a way to copy the contents of one object to another object (of the same class).

[Code]....

View 3 Replies

VS 2008 : Checking Existence Of Byte Array Inside Another Array?

Jun 2, 2010

is there is any direct method or function in array class that can check if any given byte array is a subarray of other array?or should i loop through the each byte of main array to see if smaller array exists in that or not?

View 2 Replies

Creating Array With Two Values Or Its Creating To String Index Which Will Take Value Later?

Dec 30, 2009

please tell me what is below code doing? is it creating array with two values or its creating to string index which will take value later? [code]

View 4 Replies

Class Referencing - Form4.vb Doesnt See The Shared Class1

Aug 12, 2011

I have class file class1.vb with 3 classes class1 , class2, class3. a class file class10.vb with class10 class11 class13

I declared class 1 public and declared a public shared new instance of class11 in class1 at the top

All classes in class1.vb can use this shared instance, but a form4.vb doesnt see the shared class1.(new instance of class11)

View 1 Replies

VS 2008 Class Library - Declare New Instance Of MainClass() Before Using Subs/Functions In Class2 Or Class3?

Feb 3, 2011

Namespace MyClassLib
Public Class MainClass
Public Sub New()

[CODE]...

Is it possible to make it so that the user using the Class Library has to declare a new Instance of MainClass() before using Subs/Functions in Class2 or Class3?

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

Accessing And Creating Variables Inside A For Loop?

Oct 15, 2011

I have some variables that are distinct by numbers, like in1, in2...If I have for loop, how would I access those variables, using the counter, and attaching it to the variable?I believe in JAVA, you could just use in+ct... where ct is the counter to access the variable.also how could you make a new variable in the for loop?Initially I had variables declare outside of the for loop. The problem was how to access those variables using the for loop.

var_nm1 = in1.Text
var_nm2 = in2.Text
var_nm3 = in3.Text
Dim nmList(2) As Integer

[code]....

This is object oriented programming, and I made the textboxes in1, in2, and in3 using the GUI editor. that was so easy.

View 10 Replies

Handle The Errors Inside .dll Files When Creating Them In .Net?

Jan 9, 2012

I know this idea of - if message boxes are used to display error messages inside a .dll and when the .dll is installed in a different computer (possibly a server machine), errors occurring inside that .dll will be shown in the server and not to the user. Since practically there will not be a person near the server to click 'OK' to the error message every time it occurs it will stuck the programs using the .dll.

So how to write exception handling to a .dll project?

View 1 Replies

VS 2008 Creating A Label/textbox Inside A Groupbox?

Oct 19, 2009

I've been struggling with something I imagined would be simple. My aim is to create a TextBox or Label with in a GroupBox using VB.net, yes I could use the Toolbox/Common Controls to do this easily, but it's a pain when planning on making more than just one or two of them

Here's my current coding to create the actual text box.

[Code]...

All that works perfectly, but how would I allow it to show up within a GroupBox?

View 7 Replies

Using An Array Inside Of A Structure In VB?

May 17, 2012

I'm trying to create a structure and inside it put an array of "Genres". This is my structure declaration:

Structure BookData
Dim strGenres() As String

[code]....

But I keep getting an error with the .strGenres(5). VB is telling me "End of statement expected"

View 10 Replies

RE: Creating A Dimensional Array & Sub Array

Jun 9, 2011

I developing a roster application (asp.net with VB + sql server) to let user input shift duty record, proposed screen as follows:for the database design, each staff will have one record per day.[code]I want to create a multi dimensional array to bind the gridview.Is that correct that I create a arraylist (for 7 days) and then a subarray for each day? How can I create a 7 dimensional array & sub array under this 7-D array in asp.net + VB ?

View 1 Replies

Array Query Inside For Loop?

Feb 25, 2011

I am having trouble using FOR loop with array in query.What I am trying to do is for all the data pulled out of database I convert it to an array list and then string (this works fine). After that I am trying to make a FOR loop query for each of the data pulled out and this is where i am having trouble.

[Code]...

View 5 Replies

Clear All The Items Inside The Array?

Sep 2, 2011

How can I clear all the items inside the array?

however I tried all the below codes and nothing has worked out

Public FRec() As DataRow
If FRec Is Nothing Then
Else

[Code]....

View 1 Replies

Executing An IF Statement Inside An Array?

Aug 1, 2011

I am needing a way that an if statement stored inside of an array can be executed.I am designing an application that will allow users to input if statements that will be used to determine if certain values are met. The input is saved to an array that I need to be executed later. Is this possible in Visual Basic?

View 24 Replies

Array Not Printing In 2D Form Inside A TextBox?

Apr 19, 2012

Private Sub Command4_Click()
Dim x As Integer
r = InputBox("Enter row size ")
c = InputBox("Enter coloum size ")

[code]....

This is my code for taking inputs in an array. Here everything is working fine except this line "Text1.Text = Text1.Text & vbNewLine & vbCr" here i am trying to print the array in row-coloum in 2D form inside a text box but its not happening "vbNewLine or vbcr" both are not working and my array is getting printed in a single line.

View 1 Replies

Define An Array Inside Of The Sub Call Parentheses?

Mar 22, 2011

Is there a way to define an array inside of the sub call parentheses?

Private Sub sub_name(byval sString, arrString)
sub_name("Some Text", array.{"","",""})

What I've been doing is passing a string and using a split on it to break it into an array in the Sub/Function, but I was wondering if there was a way to make the array inside the parentheses. I've looked through Google, but I'm guessing I'm not asking the right questions or it's not possible.

View 6 Replies

Preserve An Array Inside A Class Method?

Mar 30, 2010

I have been learning about OOP and classes from a book and one of the question is the book has asked to create a simple Saving/Checking accounts Program. The question says that most of the functionality must be done through an Accounts Class, and this Acoounts class must inherit certain private fileds from an base class 'Transaction.

The question also says that data from the Saving/Checking accounts Program must be read to and from a text file, and these functions must be done within the Acounts class.

i have done everything the question asks to the best of my knowlegde and understanding but when it comes to storing and retieving data from the textfile i cannot utilise the array i created to store the textfile data onto it.

Bank Account.Write a program to maintain a person's Savings and Checking accounts. The program should keep track of and display the balances in both accounts, and maintain a list of transactions (deposits, withdrawals, fund transfers, and check clearings) separately for each account. The two lists of transactions should be stored in sequential files so that they will persist between program sessions.

Consider the form in Figure 11.12. The two dropdown combo boxes should each contain the items Checking and Savings. Each of the four group boxes corresponds to a type of transaction. (When Savings is selected in the Account combo box, the Check group box should disappear.) The user makes a transaction by typing data into the text boxes of a group box and pressing the button. The items appearing in the Transactions list box should correspond to the type of account that has been selected. The caption of the second label in the Transfer group box should toggle between "to Checking" and "to Savings" depending on the item selected in the "Transfer from" combo box. If a transaction cannot be carried out, a message (such as "Insufficient funds") should be displayed.

The program should use two classes, Transaction and Account. The class Transaction should have properties for transaction name, amount, date, and whether it is a credit (deposit) or debit (withdrawal/check). The class Account, which will have both a checking account and a savings account as instances, should use an array of Transaction objects. In addition, it should have properties for name (Checking or Savings) and balance. It should have methods to carry out a transaction (if possible), to display the list of transactions, and to load and retrieve the set of transactions into or from a sequential file. The events InsufficientFunds and TransactionCommitted should be triggered at appropriate times.

Hint: In order for an Account object to display a list of transactions, a list box should be passed to a method as an argument. The method might be declared with Sub EnumerateTransactions(ByVal lb As ListBox).

Here is my code. I am sorry this code is basic and unedited.

Public Class Form3
'load contents of Text file into the listbox when first loaded
'store data in file into array of accounts, record no. counts

[code]....

View 3 Replies

Reference - Array Resizing Inside A Function?

May 2, 2012

I am running into an issue with Array resizing in vb.net. I sort of understand why the issue is coming up but I'm not sure how to get around it. Basically, I have a class that has an array of objects being passed to it. I'm trying to have a sub resize the array and add another object to it. However, once it's done, the original object does not get updated.

Optimally I would like something like this.

Sub Main()
Dim parent As New Parent
Dim first As New Child()

[Code].....

View 3 Replies

Referencing An Object Inside An Array In Runtime

Dec 30, 2009

i'm trying to reference an object dynamically inside a loop; something like this:[code]

View 6 Replies

Summing Data Inside Of An Array Element

May 3, 2011

I am working on a sale report program. Its purpose is to record the new item and the amount made from the item mon - fri. My problem isn't getting the total. I am using a For..Next to do this. The problem is that everytime i add a new item it changes all of the previous items weekly totals as well. Thus throwing off my Total Sales. My initial suspicion is that since i don't have it added as part of the output i display it changes and re-adds it to all old items.

The section of code below is the area where i believe my problem is.
The Array itemNames holds 10 elements for the Items sold.
The Array itemSales holds the weekly price data.

' add item to listbox
For counterItem = 0 To itemCount Step 1

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

View 4 Replies

Searching And Finding Strings Inside A 2-Dimensional Array?

Nov 14, 2011

I am working on arrays and I am currently having trouble with searching and finding arrays. In this example, the user should be able to enter a Name, and it will output that person's stats.

Here is the text file (note, I should be able to go to this text file, add a few more names and the code should still work, which is why I am using loops,arrays,text files instead of if and else statements),

Kobe,29,6,4
Allen Iverson,28,7,4
Jason Kidd,12,10,9

So if the user enters Jason Kidd in the text box, this will display in another text box:

Jason Kidd averaged 12 points, 10 assist, and 9 rebounds.

[Code]...

All right now is the searching part. I really do know how to search for what the user entered and display the statement in a text box. I kind of have an idea of how to just get the name, but for it to get the name and then all the data for that name puzzles me even more.-I tried using .contain, indexof and few others.

I know to display the information in the text box will be something like:

textboxoutput.text = PlayerName & " averaged " & PlayerPoints & " points, " & PlayerAssist &" assist, and " PlayerRebounds " &" rebounds"

So basically, I want it to where the user can enter a basketball players name and display the values for that name.

View 4 Replies

VS 2010 Calculate Average Of Double Inside An Array?

Aug 18, 2011

I'm working with an API, for this I'm using this particular call: [URL]

If i use this, I will get all the .price values:

For i = 0 To .bets.Length - 1
With .bets(i)
Print(.price)
End With
Next

Can I calc the average .price value? I will need to sum all the values as well.

View 8 Replies

VS 2005 Calling An Event From The Class: "Class1"?

Jun 1, 2011

I am working with a class that I need to class when ever the end-user wishes to do so. The two events are called: Remove and Add, I don't know how to call them, at all. I am using the Call command, but to do avial!! They are inside the same Class, but they are two entirely different events, that need to be called at different times, during the execution of the program's processes..

View 8 Replies

Calling A Function / Assign Property Of An Object Inside An Array

Oct 5, 2010

So if I create an object test, and it has a property color. When I add this object to an array list I typically can access this using myarray(0).color but intellisense doesn't 'know' that I have a 'test' object inside the array. It would let me type myarray(0).whatever but would then crash if I made typo. It seems like I should be able to let it know what type of object I am trying to work with inside the arraylist. In code maybe something like this

[Code]....

View 1 Replies

"add Reference" In Another Project And Choose Class1?

Jun 7, 2009

i have a class is named : class1. i want to export it to dll file i knew "add reference" in another project and choose class1 .

View 4 Replies

How To Searching Part Of Object Inside Array List Without Looping Method

Feb 10, 2012

I save the client data into an array list. How to find part of data(currentIP) inside the array list(clientList) with fast method? [code]

View 1 Replies

VS 2010 Creating A Folder Inside Temp Then / Extracting File + Opening Folder

Dec 12, 2011

How would I create a dir Inside %temp%? Then extract the file to it and Open a That folder. So far this is my code.

[Code]...

View 5 Replies







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