Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# creating matricies

Posted on 1998-10-27
Medium Priority
143 Views
I want to create a nxn matrix of integers so I do:
dim A(n,n) as integer
now I want to be able to enter values row by row like:
A(1) = Array(1,2,3,4,5,6,7,8...)
A(2) = Array(2,3,4,5,6,7,8,9...)
The command above doesn't work, but is there one that does?
0
Question by:BoB
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 18

Accepted Solution

deighton earned 200 total points
ID: 1441785
'Heres a quick function I've written

Private Function LoadMatrix(Matrix() As Integer, iRow As Long, ByVal sValues As String)

Dim sTemp As String
Dim iL As Long
Dim iVal As Long

While sValues <> ""

iVal = InStr(sValues, ",")
If iVal = 0 Then iVal = Len(sValues) Else iVal = iVal - 1

iL = iL + 1

Matrix(iRow, iL) = CInt(Left(sValues, iVal))

sValues = Mid(sValues, iVal + 2)

Wend

End Function

'Example

Private Sub Command1_Click()

Dim m(5, 5) As Integer

For c = 1 To 5
MsgBox CStr(m(1, c))

Next

End Sub

0

Author Comment

ID: 1441786
very nice, thanks!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
###### Suggested Courses
Course of the Month6 days, 9 hours left to enroll