473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with sum or rows using arrays in VB

I need to do a sum of rows and sum of columns in Visual Basic. Is there
another way to do it other than the one I have below?

5 7 3 9 12
4 8 9 13 4
0 -`1 -7 13 8
4 4 4 4 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformAction_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuPerformAction.Click
If MenuSumRows.Checked = True Then
Dim result(3)
For rows = 0 To 3
total = 0
For columns = 0 To 4
total = total + array(rows, columns)
Next
result(rows) = total
Next
response = MsgBox("Row 1: " & result(0) & ControlChars.NewLine
& _
"Row 2: " & result(1) & ControlChars.NewLine & _
"Row 3: " & result(2) & ControlChars.NewLine & _
"Row 4: " & result(3) & ControlChars.NewLine &
ControlChars.NewLine & _
"Continue?", MsgBoxStyle.YesNo, "Sum of Rows")
If response = MsgBoxResult.No Then
End
Nov 20 '05 #1
4 2942
i believe that vb.net has matrix functions you just need to find the right
namespace check the msdn

WStoreyII

"rburdette" <rb*******@cox.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I need to do a sum of rows and sum of columns in Visual Basic. Is there
another way to do it other than the one I have below?

5 7 3 9 12
4 8 9 13 4
0 -`1 -7 13 8
4 4 4 4 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformAction_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuPerformAction.Click
If MenuSumRows.Checked = True Then
Dim result(3)
For rows = 0 To 3
total = 0
For columns = 0 To 4
total = total + array(rows, columns)
Next
result(rows) = total
Next
response = MsgBox("Row 1: " & result(0) & ControlChars.NewLine & _
"Row 2: " & result(1) & ControlChars.NewLine & _
"Row 3: " & result(2) & ControlChars.NewLine & _
"Row 4: " & result(3) & ControlChars.NewLine &
ControlChars.NewLine & _
"Continue?", MsgBoxStyle.YesNo, "Sum of Rows")
If response = MsgBoxResult.No Then
End

Nov 20 '05 #2
i believe that vb.net has matrix functions you just need to find the right
namespace check the msdn

WStoreyII

"rburdette" <rb*******@cox.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I need to do a sum of rows and sum of columns in Visual Basic. Is there
another way to do it other than the one I have below?

5 7 3 9 12
4 8 9 13 4
0 -`1 -7 13 8
4 4 4 4 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformAction_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuPerformAction.Click
If MenuSumRows.Checked = True Then
Dim result(3)
For rows = 0 To 3
total = 0
For columns = 0 To 4
total = total + array(rows, columns)
Next
result(rows) = total
Next
response = MsgBox("Row 1: " & result(0) & ControlChars.NewLine & _
"Row 2: " & result(1) & ControlChars.NewLine & _
"Row 3: " & result(2) & ControlChars.NewLine & _
"Row 4: " & result(3) & ControlChars.NewLine &
ControlChars.NewLine & _
"Continue?", MsgBoxStyle.YesNo, "Sum of Rows")
If response = MsgBoxResult.No Then
End

Nov 20 '05 #3
The .NET Framework has no built in support for matix manipulation other than
a 3 x 3 matrix in the System.Drawing.Drawing2D namespace which is intended
for graphical operations.

One potential solution is a the MapPack DLL from Lutz Roeder's. You may
download a free copy of MapPack at:

http://www.aisto.com/roeder/dotnet/
--
Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"WStoreyII" <pa**********@sbcglobal.net> wrote in message
news:rh******************@newssvr29.news.prodigy.c om...
i believe that vb.net has matrix functions you just need to find the right
namespace check the msdn

WStoreyII

"rburdette" <rb*******@cox.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I need to do a sum of rows and sum of columns in Visual Basic. Is there
another way to do it other than the one I have below?

5 7 3 9 12
4 8 9 13 4
0 -`1 -7 13 8
4 4 4 4 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformAction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuPerformAction.Click
If MenuSumRows.Checked = True Then
Dim result(3)
For rows = 0 To 3
total = 0
For columns = 0 To 4
total = total + array(rows, columns)
Next
result(rows) = total
Next
response = MsgBox("Row 1: " & result(0) &

ControlChars.NewLine
& _
"Row 2: " & result(1) & ControlChars.NewLine & _
"Row 3: " & result(2) & ControlChars.NewLine & _
"Row 4: " & result(3) & ControlChars.NewLine &
ControlChars.NewLine & _
"Continue?", MsgBoxStyle.YesNo, "Sum of Rows")
If response = MsgBoxResult.No Then
End


Nov 20 '05 #4
The .NET Framework has no built in support for matix manipulation other than
a 3 x 3 matrix in the System.Drawing.Drawing2D namespace which is intended
for graphical operations.

One potential solution is a the MapPack DLL from Lutz Roeder's. You may
download a free copy of MapPack at:

http://www.aisto.com/roeder/dotnet/
--
Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"WStoreyII" <pa**********@sbcglobal.net> wrote in message
news:rh******************@newssvr29.news.prodigy.c om...
i believe that vb.net has matrix functions you just need to find the right
namespace check the msdn

WStoreyII

"rburdette" <rb*******@cox.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I need to do a sum of rows and sum of columns in Visual Basic. Is there
another way to do it other than the one I have below?

5 7 3 9 12
4 8 9 13 4
0 -`1 -7 13 8
4 4 4 4 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformAction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuPerformAction.Click
If MenuSumRows.Checked = True Then
Dim result(3)
For rows = 0 To 3
total = 0
For columns = 0 To 4
total = total + array(rows, columns)
Next
result(rows) = total
Next
response = MsgBox("Row 1: " & result(0) &

ControlChars.NewLine
& _
"Row 2: " & result(1) & ControlChars.NewLine & _
"Row 3: " & result(2) & ControlChars.NewLine & _
"Row 4: " & result(3) & ControlChars.NewLine &
ControlChars.NewLine & _
"Continue?", MsgBoxStyle.YesNo, "Sum of Rows")
If response = MsgBoxResult.No Then
End


Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Sims | last post by:
Hi I have a table with something like ID PARENT 0 | -1 1 | -1 2 | 1 3 | 1
4
by: shank | last post by:
Visually, the page will look somewhat like a spreadsheet. It could have hundreds of records (rows) displayed. I want to enable the user to edit any one or any number of records and any fields, then...
15
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I...
7
by: greenflame | last post by:
I am trying to make a matrix object. I have given it some properites. I am trying to add a method. When I call the method by Test.showDims(...) I want to only enter one input, that is the method by...
7
by: pillip | last post by:
I am trying to use fopen and fget to input two files and then output them into one file. Each input file has two columns and 20 rows, however since the first column in each input file is same (...
1
by: Nathan Gilbert | last post by:
I have a function that is returning a 2D array (declared using double pointers) and I want to be able to append a row of data to the beginning and end of this array without having to create a new...
2
by: Trevor | last post by:
This works in Firefox, but not in IE. for (var i in appraisertable.rows) { var row = appraisertable.rows; alert(row.id); } IE displays "undefined" and gives the error "id is null or not an...
4
by: Christian Maier | last post by:
Hi After surfing a while I have still trouble with this array thing. I have the following function and recive a Segmentation fault, how must I code this right?? Thanks Christian Maier
1
by: dcatunlucky | last post by:
Ok, I have an assignment to write a program that multiplies two matrices. The matrices dimensions will be user defined as well as the numbers (floating point values) inside of them. The program must...
110
by: fjm | last post by:
For some reason, I have always had a hard time understanding arrays as they pertain to php and databases. I understand associative arrays just fine but when there are multidimensional arrays, I kinda...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.