473,386 Members | 1,795 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,386 software developers and data experts.

vb6 and arrays of shape

Hi,
I'm trying the following and doesn't work.
Could someone have any clue?

dim arrMyShapes(1 to MxA,1 to MxB) of New Shape

Thanks

JeanM
Jul 17 '05 #1
5 7810
"Rose Alit,mon mignon" <sr******@yahoo.ca> wrote in message news:<AS********************@news20.bellglobal.com >...
Hi,
I'm trying the following and doesn't work.
Could someone have any clue?

dim arrMyShapes(1 to MxA,1 to MxB) of New Shape


try it like this

Dim MxA As Long
Dim MxB As Long
MxA = 10
MxB = 10
Dim x&, y As Long
Dim arrMyShapes() As Shape
ReDim arrMyShapes(1 To MxA, 1 To MxB)
For x = 1 To MxA
For y = 1 To MxB
Set arrMyShapes(x, y) = New Shape
Next
Next
Jul 17 '05 #2
> > I'm trying the following and doesn't work.
Could someone have any clue?

dim arrMyShapes(1 to MxA,1 to MxB) of New Shape


try it like this

Dim MxA As Long
Dim MxB As Long
MxA = 10
MxB = 10
Dim x&, y As Long
Dim arrMyShapes() As Shape
ReDim arrMyShapes(1 To MxA, 1 To MxB)
For x = 1 To MxA
For y = 1 To MxB
Set arrMyShapes(x, y) = New Shape
Next
Next


VB does not like the way you are using New. Are you sure this doesn't have
to be a control array (Shape is a standard VB control) with an X/Y formula
(or Row/Col or whatever) to imitate 2D referencing?

Rick - MVP
Jul 17 '05 #3
Thank you Bob for answering...but doesn't seem to work. I got a message
saying "wrong use of NEW"

Otherwise how could i define a new shape control at runtime?

Thanks for help

"Bob Butler" <bu*******@earthlink.net> a écrit dans le message de
news:fa************************@posting.google.com ...
"Rose Alit,mon mignon" <sr******@yahoo.ca> wrote in message

news:<AS********************@news20.bellglobal.com >...
Hi,
I'm trying the following and doesn't work.
Could someone have any clue?

dim arrMyShapes(1 to MxA,1 to MxB) of New Shape


try it like this

Dim MxA As Long
Dim MxB As Long
MxA = 10
MxB = 10
Dim x&, y As Long
Dim arrMyShapes() As Shape
ReDim arrMyShapes(1 To MxA, 1 To MxB)
For x = 1 To MxA
For y = 1 To MxB
Set arrMyShapes(x, y) = New Shape
Next
Next

Jul 17 '05 #4
On Tue, 30 Mar 2004 23:05:53 -0500, "Rose Alit,mon mignon"
<sr******@yahoo.ca> wrote:
Thank you Bob for answering...but doesn't seem to work. I got a message
saying "wrong use of NEW"

Otherwise how could i define a new shape control at runtime?


As Rick suggested, you would be wise to use a Control Array, that way
to create a new Shape at runtime you simply Load shpArray( N )

However for convenience, there is no reason why you should not have a
two dimensional Array that refers to the iterms in the Control Array

Set shpMatrix( 1, 1 ) = shpArray( 1 )
Jul 17 '05 #5
"Rose Alit,mon mignon" <sr******@yahoo.ca> wrote in message news:<Es*********************@news20.bellglobal.co m>...
Thank you Bob for answering...but doesn't seem to work. I got a message
saying "wrong use of NEW"

Otherwise how could i define a new shape control at runtime?


Sorry, for some reason "Shape" didn't register as a control type and I
was just assuming you had an object called 'Shape' in your app. Rick
and J French provided better responses given that you are trying to
get an array of controls.
Jul 17 '05 #6

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

Similar topics

3
by: Simon Foster | last post by:
I have some code which attempts to convert Python arrays (tuples of tuples of tuples...) etc. into C arrays with equivalent contents. The prototype code is shown below. My only question is, is...
3
by: Mizrandir | last post by:
I'd like to subclass numarray's array. I'd like to add some methods and override others like __init__. I don't know how to do this and haven't found help searching the manual or the web, can...
2
by: Todd Smith | last post by:
I have this code, but I get a runtime error that says arr isn't set to an instance of a class. So how do I initialize an array of objects, calling all the constructors for each thing in the array?...
2
by: TG | last post by:
Hi there. I am working with multi-dimensional arrays and I need to get coordinates of the min value in it. using myarray.argmin() returns the index in the flatten array, which is a first...
1
by: Rolf Wester | last post by:
Hi, I want to concatenate two numpy arrays with shape (n1,n2) and (n1,n3) into a single array with shape (n1,n2+n3). I guess there is an elegant way to do this but I couldn't figure it out. So...
9
by: andy | last post by:
Hello, I have created a class called shape, I've then called the following code: shape myShape; This then calls the default constructor for this class: Shape::Shape( void )
0
by: Caffiend | last post by:
Hello again! I am still having problems with the code under the title "newbie woes", but I have moved on for now to another exercise. The book has asked me to write a program that will use two...
2
by: John [H2O] | last post by:
I'm having trouble slicing arrays: I thought I could do the following: Traceback (most recent call last): File "<string>", line 1, in <string> ValueError: shape mismatch: objects cannot be...
0
by: Terry Reedy | last post by:
John wrote: If these are numpy arrays, as appears, rather that array module arrays, then the numpy list might be a better place. In any case, using 'numpy' would have gotten the attention of...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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...
0
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...

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.