I'm new to this, so sorry if my question has been asked before. I have searched but have not been able to find, or perhaps recognise, an answer. I am using visual studio 2008 and creating an app in vb.net.
I have 4 arrays named:- account1 account2 account3 account4. They all have 4 elements.I want to assign values to the elements in the arrays in an efficient manner. I thought two for next loops would do it. [code]....
I need to loop through 2 different arrays.(Visual Basic)If I do a loop within a loop, will I get the results I need?For each order in ShippedOrders and For each order in UnshippedOrders........
I have 5 arrays, named array1 array2 array3 array4 array5. They are integer arrays each with 5 elements in them. I want to access all the elements in all the arrays using a for next loop,the pseudo code goes something like this:
for i = 1 to 5 'this loop calls each array for j = 0 to 4 ' this loop calls each element if array (i,j) then
I am trying to port a program I wrote with old VB 1 and I have many control arrays in the program, and it was so easy to do this in older versions of VB, now I am trying to find how to do this and all the answers I have found are a major productions, to replace something that was so easy to do? I would think that microsoft would make programming easer with each new incarnation. instead they are making it harder. doing away with the DATA and READ statement, now it is much harder to fill an array with a loop, now you have to enter each item in an array ONE by ONE. they did away with the ON statement, I had several ON statements, I had to make complex Select case constructs. to replace a simple one word statement?
To make an array of controls in OldVB all you had to do is Name a Second control the Same as the First, and a dialog pops up and ask if you want to make an array, you click Yes, and that's it, what could be easier than this?
Attached is a visual representation of My Array that was used in my VB6 program the dimensions are:
CODE:
I am using an ACCESS DataBase to populate the array.
Using the For Next Loop I can access any position within the array such as a individual cell or group of cells. Also using the Step Keyword of the For next loop I can select a group of cells to manipulate based on the Step factor. This worked well for me in VB 6. I am now migrating to vb 2010 and cannot fine documentation as to how this would be done on zero based arrays in Vb 2010.
In VB 2010 I see no reference to the Step Keyword nor examples of how it would be used with zero based Arrays.
A example of my use of the step keyword is:
CODE:
Any of the above loop setups works for me using VB6 Any Documentation or code would be use in my vb6 to vb2010 migration?
i have a array set up, and i need the array to be global, but i can only get vb to accept it in a button, in addition, after the loop is completed, i am trying to pull a value from the array and display it but am getting an error.the code is as follows:
Public Class Form1 Friend staten As String Friend statea As String[code].....
how to do something similar to what was a control array in VB6 in .NET? I would like to be able to fill the contents of several text boxes using a FOR NEXT loop or something similar..... corresponding the contents of an array with the texts of an equal number of text boxes.
trying to save users names and passwords from input boxes and save it as arrays in text file that in future multiple users will log in with their names and passwords have this code so far but doesnt realy save the user info to file, dont even create file.
Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
I want to go to a class.vb file that has a function from an aspx page and I want to return mutiple arrays. Is that possible? If so, how would I call it from the aspx page and how would I return it?
I'm trying to find out a way to search multiple arrays for a specific value. I looked through here, yahoo, google and msdn and couldn't find anything specific to what I'm looking for. Don't have any sample code as I'm not quite sure where to start.
2)The program needs to access particular chunks(for example (0,20) to (50,20)
3)The program will open multiple files and process each into it's own 2D array (400,20)
What I have right now is code capable of creating the array, but no way to store the array so that I can open a new file and process that data into another large array. Someone mentioned the generics List(of T) might be a good way to store each new array as you could use the Add function. I have done some research on the List(of T) class but I'm not totally convinced that is the way to go. I'm just looking for some direction as I've just started on .net this year.
i'm having issues where I can't figure out how to take a text file that was provided for my homework assignment, and put the information within it into 3 different arrays.The .txt file looks like so:tc.Amanda/Ashley have to be in the same array as well as 4/2, 166/20.This is what I've come up with for the snippet of code, and so far, it hasn't really been working right.
Dim namearray(MaxItems), rankarray1990(MaxItems), rankarray2009(MaxItems) As String Dim Numitems As Integer Dim sr As System.IO.StreamReader
I have the following code... in an MDI application. [code] Various lines of code which put data into the Myinstance and then save the instance into the ArrayList.I have buttons which run procedures and functions in the formchild and also in the Class1. I need it so you can jump between formchild instances, and when you do so and click a button on that form, it will run the Class1 code but using the data in the arraylist and myinstance that was set previously by the selected formchild. Then if you switch to another child it uses data from this form. Can this be done by declaring the arraylist with more dimensions and then refer to the records with the index of the selected form instance, e.g.Selected Child is index(3)
I have created an MDIparent form and a MDIchild. There is a button on the parent which makes multiple 'clones' of the child form, each time its clicked.I also want (maybe with a module) a set of variables, and array of a structure but these are available to each copy of the child, but each copy's variables, arraylist etc contain its own data?Therefore if you select child1 the variables and array will have different data to child2, child3...etc...
I'm looking to be able to save and load the content from multiple structured arrays and variables into/from an encrypted file, is there any reliable source of information or tutorial that I'd be able to use for this? I've never written a program in visual basic that writes to/reads from a file.
I have a VB.NET application and use some third party (closed source) ActiveX controls. One of the controls represents a "camera" (connected over several interfaces) and I try to write an example how to work with several cameras in one application. To do this I allocate multiple "camera" objects dynamically as an array which works as expected like this:
Const NUM_CAMERAS = 2 Private MyCameras(NUM_CAMERAS ) As xxx.MCamera
But the camera objects needs to be allocated with WithEvents because they raise events when a new image was taken. I found out that WithEvents variables cannot be typed as arrays and this is a pretty common problem so I also found some workarounds: [URL]. This is already pretty good and I adopted this to my concept. So I have a MyCameras array and a MyCamera all "without Events", first allocate a new MyCamera object, add a event handler and then put it into the array.
Unfortunately I get an error when calling AddHandler Camera.ProcessModifiedImage, AddressOf MyHook
Normally "MyHook" is declared as Private Sub MyHook (ByVal sender As Object, ByVal ModifiedBuffer As xxx.ProcessModifiedImageEvent) Handles Camera.ProcessModifiedImage
Like in the "Button examples" I just removed the "Handles Camera.ProcessModifiedImage" but I get an error that "MyHook" has not the same signature as the Delegate Delegate Sub ICameraEvents_ProcessModifiedImageEventHandler(ImageIndex as Integer)
I Have a complex Class Structure that holds a large amount of data in the form of multiple nested arrays that I want to save to a file and retrieve everytime I use my program.. How do I do this? I am using VB10 Express.
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??
I have learnt how to create a basic random word generator. I now want to take this further but I would like to know if what I am thinking of is possible. I am in the process of wanting to create a random name/word generator which reads/loads an array from a text file. think this part I will be Ok with as there are some vids and tutorials about. However, I wish for the text file to have multiple arrays and then dependant on the day and time of the day, only a string from the current time array is loaded. Does that make sense and is it possible? I am happy to spend time learning how to do this but only if it is possible.
I have a system that must do massive array operations. Often I have many arrays with 1 to 2 million elements at same time.
Usually I create the arrays inside a procedure, so, I expect when the array variable goes out of scope, the array becomes available to the GC. But in the near future, I'll need to do these operations in a "looping" way, so I'll create and delete the arrays many times...
Will GC free the memory associated to the arrays "in time" for the next loop or it is best to "force" it in someway, like using the erase statement? Or maybe I'm completely wrong?
I read the lines from a textfile into a string array and then I use a foreach loop on the string array. I want to go through the same string array again after the loop reach the end of the string array
I have a piece of code that loops through the rows in a database and brings out information.
The code is attached to a button(search). To search for data, you enter a phone number, the loop goes through the data rows and bring out the information is it is there.
Everything works great accept I have added a second table to the database.
So do I add a whole new loop statement? Example lets say I had a new data row, how can I add that to this statement so that both tables are searched?
This is the code:
Dim strGetRecord As String = masTxtPhoneField.Text For validData = 0 To storedtData.Rows.Count - 1 If strGetRecord = storedData.Rows(validData)("fldphone").ToString Then
i want to set 2 conditions for a for loop as i want to loop through the same line of code at the same time . here it is as i have it now
it does not work how i want it to as i want both loops to run simuntaneously instead it runs the first loops continuously before the second and way around this?
For Me.i = 0 To maxrows - 1 For Me.h = 1 To maxrows Me.Controls.Item("TextBox" & Me.h).Text =
The problem I am having is with a loop that I want to clear multiple textboxes Dim count as double = 0 dim max as double = 6 Do Until count = max textcommand = ("Textbox_"+ count +".clear()") +Textcommand+ count = count + 1 Loop [Code] .....