473,883 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformActi on_Click(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles MenuPerformActi on.Click
If MenuSumRows.Che cked = 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.Ne wLine
& _
"Row 2: " & result(1) & ControlChars.Ne wLine & _
"Row 3: " & result(2) & ControlChars.Ne wLine & _
"Row 4: " & result(3) & ControlChars.Ne wLine &
ControlChars.Ne wLine & _
"Continue?" , MsgBoxStyle.Yes No, "Sum of Rows")
If response = MsgBoxResult.No Then
End
Nov 20 '05 #1
4 2983
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******** **********@TK2M SFTNGP11.phx.gb l...
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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformActi on_Click(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles MenuPerformActi on.Click
If MenuSumRows.Che cked = 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.Ne wLine & _
"Row 2: " & result(1) & ControlChars.Ne wLine & _
"Row 3: " & result(2) & ControlChars.Ne wLine & _
"Row 4: " & result(3) & ControlChars.Ne wLine &
ControlChars.Ne wLine & _
"Continue?" , MsgBoxStyle.Yes No, "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******** **********@TK2M SFTNGP11.phx.gb l...
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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformActi on_Click(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles MenuPerformActi on.Click
If MenuSumRows.Che cked = 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.Ne wLine & _
"Row 2: " & result(1) & ControlChars.Ne wLine & _
"Row 3: " & result(2) & ControlChars.Ne wLine & _
"Row 4: " & result(3) & ControlChars.Ne wLine &
ControlChars.Ne wLine & _
"Continue?" , MsgBoxStyle.Yes No, "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**********@s bcglobal.net> wrote in message
news:rh******** **********@news svr29.news.prod igy.com...
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******** **********@TK2M SFTNGP11.phx.gb l...
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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformActi on_Click(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MenuPerformActi on.Click
If MenuSumRows.Che cked = 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.Ne wLine
& _
"Row 2: " & result(1) & ControlChars.Ne wLine & _
"Row 3: " & result(2) & ControlChars.Ne wLine & _
"Row 4: " & result(3) & ControlChars.Ne wLine &
ControlChars.Ne wLine & _
"Continue?" , MsgBoxStyle.Yes No, "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**********@s bcglobal.net> wrote in message
news:rh******** **********@news svr29.news.prod igy.com...
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******** **********@TK2M SFTNGP11.phx.gb l...
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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
array(0, 0) = 5
array(0, 1) = 7
etc........

Private Sub MenuPerformActi on_Click(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MenuPerformActi on.Click
If MenuSumRows.Che cked = 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.Ne wLine
& _
"Row 2: " & result(1) & ControlChars.Ne wLine & _
"Row 3: " & result(2) & ControlChars.Ne wLine & _
"Row 4: " & result(3) & ControlChars.Ne wLine &
ControlChars.Ne wLine & _
"Continue?" , MsgBoxStyle.Yes No, "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
2240
by: Sims | last post by:
Hi I have a table with something like ID PARENT 0 | -1 1 | -1 2 | 1 3 | 1
4
6156
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 click a save button to UPDATE the SQL table. I'd like to use stored procedures if possible. How is this done? Where do I start? thanks
15
3835
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 couldn't do it using reqular transact SQL. The problem is that this procedure is taking longer and longer to run. Up to 5 hours now! It is anaylizing about 30,000 records. I think partly because we add new records every month. The procedure...
7
1755
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 which to do it. As you can see from the object definition that it corresponds to a function that takes two inputs. When I try to run the script it does nothing. So what is wrong and how do I fix it? Here is the script. function...
7
1562
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 ( numbers 0...19), i want the output file to have 3 columns and 20 rows. Right now i am using a one dimensional array "array1" to input each file:, and the output file has 2 columns and 42 rows. #include <stdlib.h> #include <stdio.h>
1
2017
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 2D array and iterate through copy contents from arrays into this new 2D array. Example: int ** someArray; int * topRow; int * bottomRow;
2
5068
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 object." Like I said before, Firefox works great. What's my problem here?
4
2512
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
1964
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 check to see if the two matrices are able to be multiplied. This is the code that I have so far: #include "stdafx.h" #include <iostream> using namespace std;
110
7078
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 don't. I have gone over a few different examples but they were limited. I was able to find one piece of code that I would like to disect and ask questions about so I can gain a better understanding. $characters = array ( array (...
0
9942
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9574
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5797
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3233
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.