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

Combining Two Similar Procedure "Trees"

I have two *very* similar groups of related procedures in my program, and
I'd like to try combining them, but I'm running into one big problem.

Private Sub TileSearchCluster(ByVal PossibleClusterTile1 As HexicTile,
ByVal PossibleClusterTile2 As HexicTile, ByVal PossibleClusterTile3 As
HexicTile)
If Equals(PossibleClusterTile1.Color, PossibleClusterTile2.Color) Then
If Equals(PossibleClusterTile1.Color, PossibleClusterTile3.Color) Then
If TileSearchMode = "Error Checking" Then
TileLabel(a).Text = "X"
TileLabel(b).Text = "X"
TileLabel(c).Text = "X"
ErrorsPresent = True
Exit Sub
End If
End If
End If
End Sub

The PossibleClusterTile variables are members of an array of the form
Tile(1 To 85), which I gathered from TileLabel(1 To 85).BackColor using a
For/Next loop.

Somehow, I need to make TileLabel(a), (b), and (c) reference the indices of
the PossibleClusterTile variables.
Nov 21 '05 #1
2 1026
Confessor <in*****@reply.to.group> wrote in
news:Xn*********************************@130.81.64 .196:
I have two *very* similar groups of related procedures in my program,
and I'd like to try combining them, but I'm running into one big
problem.

Private Sub TileSearchCluster(ByVal PossibleClusterTile1 As HexicTile,
ByVal PossibleClusterTile2 As HexicTile, ByVal PossibleClusterTile3 As
HexicTile)
If Equals(PossibleClusterTile1.Color, PossibleClusterTile2.Color)
Then
If Equals(PossibleClusterTile1.Color, PossibleClusterTile3.Color)
Then
If TileSearchMode = "Error Checking" Then
TileLabel(a).Text = "X"
TileLabel(b).Text = "X"
TileLabel(c).Text = "X"
ErrorsPresent = True
Exit Sub
End If
End If
End If
End Sub

The PossibleClusterTile variables are members of an array of the form
Tile(1 To 85), which I gathered from TileLabel(1 To 85).BackColor
using a For/Next loop.

Somehow, I need to make TileLabel(a), (b), and (c) reference the
indices of the PossibleClusterTile variables.


Just to make my request a bit more coherent:

a, b, and c, used as placeholders for the TileLabel() indices in the code
example above, need to reference the *index* of PossibleClusterTile1, 2,
and 3, respectively.

I've had *some* success with the following:

TileLabel(System.Array.IndexOf(Tile, PossibleClusterTile1)).Text = "X"
TileLabel(System.Array.IndexOf(Tile, PossibleClusterTile2)).Text = "X"
TileLabel(System.Array.IndexOf(Tile, PossibleClusterTile3)).Text = "X"

But, in each case, it only X-es the first label in each group of three...
Nov 21 '05 #2
Confessor <in*****@reply.to.group> wrote in
news:Xn*********************************@130.81.64 .196:
Confessor <in*****@reply.to.group> wrote in
news:Xns95F96F3E658EFinvalidreplytogroup@ 130.81.64.196:
I have two *very* similar groups of related procedures in my program, and I'd like to try combining them, but I'm running into one big problem.

Private Sub TileSearchCluster(ByVal PossibleClusterTile1 As HexicTile, ByVal PossibleClusterTile2 As HexicTile, ByVal PossibleClusterTile3 As HexicTile)
If Equals(PossibleClusterTile1.Color, PossibleClusterTile2.Color) Then
If Equals(PossibleClusterTile1.Color, PossibleClusterTile3.Color) Then
If TileSearchMode = "Error Checking" Then
TileLabel(a).Text = "X"
TileLabel(b).Text = "X"
TileLabel(c).Text = "X"
ErrorsPresent = True
Exit Sub
End If
End If
End If
End Sub

The PossibleClusterTile variables are members of an array of the form Tile(1 To 85), which I gathered from TileLabel(1 To 85).BackColor using a For/Next loop.

Somehow, I need to make TileLabel(a), (b), and (c) reference the indices of the PossibleClusterTile variables.
Just to make my request a bit more coherent:

a, b, and c, used as placeholders for the TileLabel()

indices in the code example above, need to reference the *index* of
PossibleClusterTile1, 2, and 3, respectively.

I've had *some* success with the following:

TileLabel(System.Array.IndexOf(Tile, PossibleClusterTile1)).Text = "X" TileLabel(System.Array.IndexOf(Tile, PossibleClusterTile2)).Text = "X" TileLabel(System.Array.IndexOf(Tile, PossibleClusterTile3)).Text = "X"
But, in each case, it only X-es the first label in each group of three...


I was able to work *around* my problem by changing the
ByVals to ByRefs, allowing me to use/modify a new
Boolean InError variable in my HexicTile structure.

After all possible error-causing scenarios were
checked, I was able to transfer the results back to the
GUI Labels using the following text.

For T = 1 To 85
If Tile(T).InError = True Then
TileLabel(T).Text = "X"
ErrorsPresent = True
End If
Next

This is probably more of a stop-gap measure than an
ideal solution, however, so any suggestions would still
be appreciated.
Nov 21 '05 #3

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

Similar topics

25
by: delerious | last post by:
I see some code examples like this: <DIV onmouseover="this.style.background='blue'"> and other code examples like this: <DIV onmouseover="javascript:this.style.background='blue'"> Which...
205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
4
by: Robin Tucker | last post by:
Hi, I'm currently implementing a database with a tree structure in a table. The nodes in the tree are stored as records with a column called "Parent". The root of the tree has a "NULL" parent....
19
by: Christian Fowler | last post by:
I have a VERY LARGE pile of geographic data that I am importing into a database (db of choice is postgres, though may hop to oracle if necessary). The data is strictly hierarchical - each node has...
46
by: TTroy | last post by:
Hi, I'm just wondering why people/books/experts say "the function returns a pointer to.." or "we have to send scanf a pointer to.." instead of "the function returns the address of.." or "we have...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
9
by: Tristán White | last post by:
Hi I am very new to PHP - actually, this is my second day at it, as I've only recently started a new job last week. We're a charity. I have a "No input file selected" problem. A Google search...
3
by: roger.dunham | last post by:
Hi there, I am writing an application that performs calculations on records within a data table. There may be many records in a data table. There are situations where the calculation may not...
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: 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
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,...
0
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,...
0
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...
0
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...

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.