VS 2010 - Arrays And Do Loops With Rows And Columns
Feb 28, 2011
So I am writing a program that uses ArrayA(10) and ArrayB(10) and uses Do loops to output the sum of ArrayA(1) + ArrayB(1) in one column then the difference in the next column, then the product in the next column, then the quotient in column 4 of a Matrix(10, 4) in a listbox. And continues doing this until there are 10 rows of 4 columns. I was wondering for tips on how I can get this done.
View 6 Replies
ADVERTISEMENT
Feb 10, 2012
ames tile1 to tile 100Array is loaded from a textfile of 10,10 (not stored as a 10,10 just parsed from line to line, which I feel needs to be changed asap)Each tile is then given a corresponding graphic (e.g. grass, water, lava) and soon hopefully I will add interaction with certain tiles
View 2 Replies
Oct 2, 2011
Been given an assignment to create a space invaders game. Although there's a long way around, is there a way to make my code smarter.Here's the section to make a row of invaders so far:
Public Class Form1
'number of invaders in a row (horizontal)
Dim numberofinvaders As Integer = 11
'set of invaders (vertical)
[code]....
So what I want to do more precisely is have the value of setofinvaders to change how many rows of invaders vertically in a loop.
View 13 Replies
May 21, 2009
I have 5 arrays named array1 array2 array3 array4 array5. Each array has 5 elements. I want to access each element in each loop via a for next loop the pseudo code would be something like this.
for i = 1 to 5 / this loop calls the individual arrays
for j = 0 to 4/ this loop calls the elements in each array
array (i,j) /do some action on the element here
next j
next i
But as it stands, there is no array called simply array, and I can't figure out how to append the i counter to the word array and thus achieve what I want.
The alternative is to have 5 separate loops, one for each array but I feel sure there must be a better way.
View 5 Replies
Nov 23, 2009
I'm trying to create two arrays filled with a set of strings from two tables in a database and then compare them. For example:
array1[0]="1101" and
array2[0]="0110"
If both respective characters equals 1 then perform an action. But when I run this code I receive the error: Index was outside the bounds of the array. System.IndexOutOfRangeException.
For some reason I believe the problem area is with the following two statements:
comparestringa = userintarray(x) and
comparestringb = eventintarray(x)
When I comment them out, the error doesn't show.
myconnect = New SqlConnection("xxxx")
Dim Table1 As New SqlCommand("SELECT * FROM Table1", myconnect)
Dim Table2 As New SqlCommand("SELECT * FROM Table2", myconnect)
Dim array1 As New ArrayList
Dim array2 As New ArrayList
Table1.Connection.Open()
[Code] .....
View 4 Replies
Aug 18, 2011
I have Dataset ds filled up with values Until now I was displaying values in GridView. Now I want that all the rows should be columns and columns should be rows.I have 2 options: Either 1 I can directly convert grid to columns and display it, or 2 I can convert the GridView to html and then write loops to convert. I was trying the 2nd option but I cant figure out how I should do that.[code]With this code I am still getting same as GridView. Please help me for converting rows to columns and vice versa.
View 1 Replies
Apr 6, 2012
I want to edit the rows and columns of an excel file using vb 2010 express. NOTE : I dont want to open .exl file but want my program to read and edit them according to user. PS : I want to edit them according to cell number.
View 6 Replies
Apr 15, 2012
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].....
View 7 Replies
Dec 2, 2010
I need to create an console application that computes the average monthly rainfall, number of months with above average rainfall, and the number of months with below average rainfall, given the rainfall amounts for each month in a particular year. The program must read in and store in an array the monthly rainfall amounts entered by the user one by one.
So far this is what I have got
Const intMonths As Integer = 11 'Constant Month variable
Dim sngRainfall(intMonths) As Single 'Rain for the month
Dim intCount As Integer ' Loop Counter
Dim sngTotalRainfall, sngAvgRainfall As Single 'Total and Average Rainfall
[Code] .....
How to set this up properly and I am having a real hard time figuring out how to make the data go from this loop to another and add the data to the total.
View 15 Replies
Aug 25, 2011
I have a csv file. I need to open it, delete whole row on basis of a column value, Update few of the column values and save the file as .dat file. I am using VB.net 2010
View 1 Replies
Sep 4, 2009
I have an unbound datagridview, the datagridviews columns count may very depending on how many are needed like so
For i = 1 To myColumn
Dim RP As DataGridViewColumn = New DataGridViewCheckBoxColumn
RP.AutoSizeMode = DataGridViewAutoSizeColumnMode.None
[Code]...
The problem with this is that it puts everything in the first column instead of each column.
What I was trying was to have it place each value into its own column.
View 1 Replies
Jan 27, 2009
I have taken this part from a previous application that works. This does not display any thing in the grid when i watch it it does show that it got 1 row but in reality it does not display it
Private Sub btn_all_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_all.Click
Dim con3 As New SqlConnection("xxxx")
[Code].....
View 3 Replies
Feb 14, 2010
I am stuck on how I go about using the nested for loops.Add code in the Draw button�s Click event to create the number of rows and columns selected, using the character selected Use nested For loops to create the rectangle of characters based on the user selections. The outer loop will control the number of rows. Use the value selected in the Rows combo to determine the stopping value of the outer loop. Use the value selected in the Columns combo to determine the stopping value of the inner loop, which controls the number of characters per line.
Public Class MainForm
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cb_Rows.Items.Add(1)
cb_Rows.Items.Add(2)
[code]....
View 6 Replies
May 20, 2009
So I'm in the final stages of finishing a program I've been working on for nearly a year now, and this is basically my final hurdle. The Save dialogue is working beautifully, with 'flags' in order to switch it over from the regular input into text boxes to the Listbox input protocol.
However, I'm having a *** of a time getting it to take lines from the text file and put them in the proper text box. Here is an example file:
Quote:
SHOWNAME
CALLNAME
BREED
[Code]....
So with the sample file I provided above, in the textbox named callNameText would appear "SHOWNAME", and so on and so forth. With this build, I get a NullReferenceException on the "Me.Controls(strboxNames(i)).Text() = strAllText(ati)" line.
View 1 Replies
Nov 7, 2011
I have a student database in ms-access format with 3 tables
1) class ( classid, classname)
2) subjects ( subjectid, classid, subjectname)
3) students (studentid, classid, studentname)
now i want to create a form to enter exam marks for the students in the following manner:
studentid, studentname, classname, subjectname1, subjectname2, subjectname3, .... subjectname-n
1, student1, class1, marks, marks, marks, marks, marks
2, student2, class2, marks, marks, marks, marks, marks
3, student3, class3, marks, marks, marks, marks, marks
how i can i convert subjectname from row to column and how to write a new table to store exam marks for this purpose.
View 3 Replies
Apr 23, 2012
I'd like to copy some rows of data from a data-bound datagridview to a different datagridview.I thought adding a row would just be like this: [code]The trouble is that, instead of copying all the data from the row and putting it in the correct cells in the other datagridview, it seems to be taking the whole row object and putting it in the first cell, so the first cell contains this: [code]And the other rows are empty. How do I make rows copy properly?
View 3 Replies
Feb 9, 2010
i want to make a datagrid with 2 columns and many rows
the columns i want to have databinding with a datatable
i want the 1 row 1 column of datagrid have data from 1 row of datatable
i want the 1 row 2 column of datagrid have data from 2 row of datatable
[code].....
View 2 Replies
Feb 20, 2012
[Code] The code in above had already create rows and columns(row=20,column=8),and all data have already insert into datagridview1 when i click button1. Now i want insert data again when i click button2. Because the datagriview have already create rows and columns. In button 2, i don't want create again rows and columns, i just want insert 10 rows data into datagriview1. Which part that i need to eliminate?
View 2 Replies
Jun 4, 2012
I have the following data structure in a data base.
Table File
- File_ID (PK)
- File_Name
View 2 Replies
Feb 25, 2011
I am using Datagridview to show some table data from database. It is working but its appearance is not what i am looking for. Is there a way to edit columns and rows manually ?
This is a list of what i want to do :
1. First of all i want to change column captions. because they are like "Fld_name" etc.
2. There is a column that shows date. I want to write a code for it ( convert date type )
3. I want to add a button at the end of each row and write a code for it ( show detail about that record )
View 11 Replies
Feb 12, 2009
In my application i need to move rows and columns in tablelayout panel at runtime.like how to we are doing at designtime.
View 3 Replies
Jul 31, 2010
In my datagrid, I know the number of rows that it will have - it will always have 12 rows.Can I scroll through the cells downwards via the columns instead of the usual horizontal way via the rows?
View 3 Replies
Dec 12, 2010
I am trying to create a console application that computes the row and column sum and prints the elements with the resulting sums for each row and column.[code]My column sum code is currently showing the row sums.and the rowsum code is showing a continuous sum, rather than a sum for just that row.
View 4 Replies
Jun 12, 2011
How do I updatezz data from 2 rows to 2 columns?
tool: vb.net
server: MySQL (SQLyog)
I have 2 tables, membercardlist and memberinfo:
table membercardlist:
------------- ------------ ------------
| AccountNo | CardNo | status |
------------- ------------ ------------
| 9999 | B009 | inactive |
[Code]......
View 6 Replies
Aug 20, 2009
how to print, and got it working pretty well. The text string I have printing into a rectangle, and if a word does not fit it will wrap down to the next line, and then keep going like that, but now I need to split my page into three different areas that will each print different text.I am pretty sure I could draw three different rectangels then draw the text I need on each of them, but is it possible to somehow merge them together into a single rectangle that will be printed?
View 9 Replies
Oct 8, 2011
the purpose of the program is to display the monthly payments on the loan.My homework is to use do while loops instead of for loop.Here is the code for the for loop.
Option Explicit On
Option Strict On
Option Infer Off
[code].....
Now I'm having some trouble displaying the output using the do while loop, and I'm pretty sure it's a loop problem on my code. However, I cannot seemed to find out what's wrong. I looked at the examples of do while loop in my textbook, but I couldn't find anything useful to my problems of my program.This is the output for the do while loop.
Here's the do while loop code
Option Explicit On
Option Strict On
Option Infer Off
[code].....
View 3 Replies
Aug 16, 2010
I am trying to calculate an equation every time I change something in the Worksheet. [code] Everytime I try this formula everything locks up. Maybe I could limit the rows and columns to be scanned to D2:F500.
View 4 Replies
Jun 5, 2011
what i need to do is to get some data from sqlserver and send it to a dataset(no problem there) after i get the dataset filled i need to send the columns and rows to a textfile but i have to separate the columns on the dataset with this "|"
View 2 Replies
Jul 21, 2011
I have divided the circle into rows and columns and each block(square) formed in the circle is of equal size. I have the X and Y co-ordinates of each square/block. Each block is either defined as good or bad.
Problem: I need to add 2 blocks on the same row and determine if the result is good or bad. If any of the block is bad, the group of two block is called as bad. If both are good, only then group is good. what would be the algorithm for it? I need to do in visual basic language. Also, I need to do more cases like adding 3 blocks and determine if the group of 3 block is good or bad. In this, if any block is bad, the whole group is bad.
Update: When I divided the circle into rows and columns i.e blocks, I remove the blocks that are not in the shape of square. That is, those square/blocks which are touching the circumference of circle are deleted. I can upload the photo tomorrow now.
View 1 Replies
Jan 6, 2011
I have the following table:
----------------------------------------------
ID|Name |City |Phone |IsWorking
----------------------------------------------
1 |Joe |New York |111-111-1111|No
----------------------------------------------
[code]....
View 3 Replies