473,386 Members | 1,846 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.

Newb Question on Array Declaration

I am defining a class that has, as a member, an array of another
user-defined class.

private mBoard as CBoardPosition()

The problem comes when I attempt to size the array, it should be an 8x8
grid. When I use:

mBoard = New CBoardPosition (7,7)

When I do this, VB thinks I am trying to send two integers to the New
function of the class, not defining it as a 8x8 2d array. This results
in an error as the new function of CBoardPosition takes no parameters.

What is the proper syntax for this? I know I must be missing something
simple.

Nov 22 '05 #1
5 1870
Hi,

Try this:

Private mBoard(7,7) As CBoardPosition = New CBoardPosition()

Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"HateSpam" <Ha******@nospam.com> wrote in message
news:8f*****************@fe2.columbus.rr.com...
I am defining a class that has, as a member, an array of another
user-defined class.

private mBoard as CBoardPosition()

The problem comes when I attempt to size the array, it should be an 8x8
grid. When I use:

mBoard = New CBoardPosition (7,7)

When I do this, VB thinks I am trying to send two integers to the New
function of the class, not defining it as a 8x8 2d array. This results
in an error as the new function of CBoardPosition takes no parameters.

What is the proper syntax for this? I know I must be missing something
simple.

Nov 22 '05 #2
Please do not multi-post. Instead, you can cross-post - post to all groups
at the same time.

"HateSpam" <Ha******@nospam.com> wrote in message
news:8f*****************@fe2.columbus.rr.com...
I am defining a class that has, as a member, an array of another
user-defined class.

private mBoard as CBoardPosition()

The problem comes when I attempt to size the array, it should be an 8x8
grid. When I use:

mBoard = New CBoardPosition (7,7)

When I do this, VB thinks I am trying to send two integers to the New
function of the class, not defining it as a 8x8 2d array. This results in
an error as the new function of CBoardPosition takes no parameters.

What is the proper syntax for this? I know I must be missing something
simple.

Nov 22 '05 #3
> Private mBoard(7,7) As CBoardPosition = New CBoardPosition()
Wouldn't that throw up a compile time error saying something like explicit
initialization not permitted for arrays?


Nov 22 '05 #4
see reply in dotnet.languages.vb group.

"Imran Koradia" <no****@microsoft.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Please do not multi-post. Instead, you can cross-post - post to all groups
at the same time.

Nov 22 '05 #5
Hi,

Yeah, you're right. What was I thinking? Use this instead:

Private mBoard(,) As CBoardPosition

Then to size it:

ReDim mBoard(7,7)

Sorry about that. Ken.

That'll do it. Then
"Imran Koradia" <no****@microsoft.com> wrote in message
news:eK**************@tk2msftngp13.phx.gbl...
Private mBoard(7,7) As CBoardPosition = New CBoardPosition()

Wouldn't that throw up a compile time error saying something like explicit
initialization not permitted for arrays?

Nov 22 '05 #6

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
3
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
8
by: User | last post by:
Hi, This is very basic, It may be a repost, if so I'm sorry. The problem is that this declaration : Private strMyArray(100) As String will create an array of string with a length of 101,...
1
by: Sam | last post by:
Hello all I have a two dimensional array (the dimensions are not known) that needs to be passed to fortran from c++, allocate the dimensions of the array in fortran code, do some filling up of...
4
by: Chris | last post by:
I've lurked around long enough... Time to interract =) I'm trying to make sense of the following. I can't quite wrap my head around what this is actually doing: ------------- typedef enum {...
3
by: HateSpam | last post by:
I am defining a class that has, as a member, an array of another user-defined class. private mBoard as CBoardPosition() The problem comes when I attempt to size the array, it should be an 8x8...
6
by: tommydogs | last post by:
I am just starting out with AxWebBrowser and need help with a simple application. I just want to navigate to a web page, then read in source code. Here's what I have so far: Private Sub...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
18
by: mdh | last post by:
>From p112 ( K&R). Given an array declared as static char arr= { { 0,1,........},{0,1,.....}}; let arr be passed as an argument to f. f( int (*arr) ) {....} It is noted that the...
26
by: aruna.mysore | last post by:
Hi all, I have a specific problem passing a function pointer array as a parameter to a function. I am trying to use a function which takes a function pointer array as an argument. I am too sure...
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: 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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.