473,670 Members | 2,563 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 2975
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
2221
by: Sims | last post by:
Hi I have a table with something like ID PARENT 0 | -1 1 | -1 2 | 1 3 | 1
4
6134
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
3819
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
1742
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
1547
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
2005
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
5060
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
2499
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
1957
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
6963
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
8466
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
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8659
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7412
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
4208
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...
1
2799
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
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1791
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.