Hi,
I have two arrays: ArrayMyTop and ArrayMyLeft. Basically I wish to search both arrays to find instances where the input from two ComboBox's match the values that appear in the same position of each array, for example:
ArrayMyTop = 1,2,3,4,5,6
ArrayMyLeft = 7,8,9,10,11,12
ComboBox1 Input = 3
ComboBox2 Input = 9
A match would be found in position 3 of both array's, the values 3 and 9 both exist. However if the inputs were 2 and 9 respectively, this would not be found as although both values are in the array, they are not in the same positions.
For implementing this I was considering having a for … next loop within a for … next loop, but I thought that maybe a 2D array would be a lot better. However I am not sure how to implement this in VB!! The following is the code I have for searching one of the array's and my question is how would I turn this into a 2D array using inputs from two combo boxes to find a match within the array.
Hope this makes sense,
Chris
I have two arrays: ArrayMyTop and ArrayMyLeft. Basically I wish to search both arrays to find instances where the input from two ComboBox's match the values that appear in the same position of each array, for example:
ArrayMyTop = 1,2,3,4,5,6
ArrayMyLeft = 7,8,9,10,11,12
ComboBox1 Input = 3
ComboBox2 Input = 9
A match would be found in position 3 of both array's, the values 3 and 9 both exist. However if the inputs were 2 and 9 respectively, this would not be found as although both values are in the array, they are not in the same positions.
For implementing this I was considering having a for … next loop within a for … next loop, but I thought that maybe a 2D array would be a lot better. However I am not sure how to implement this in VB!! The following is the code I have for searching one of the array's and my question is how would I turn this into a 2D array using inputs from two combo boxes to find a match within the array.
Code:
found = False
For i = LBound(ArrayMyTop) To UBound(ArrayMyTop)
If (ComboBox1.Value * 18) + 60 = ArrayMyTop(i) Then
msg = MsgBox("Button Not Created - Already Exists", vbOKOnly, "Button Creation")
found = True
Exit For
End If
Next i
Chris