What's new

.NET [VB.NET] Algorithm Help! :(

  • Thread starter Revvv
  • Start date
  • Views 387
Revvv

Revvv

Getting There
Experienced Veteran Grizzled Veteran Seasoned Veteran
Messages
1,924
Reaction score
290
Points
220
Sin$
0
So I'm trying to pick from a selections of variables depending on their value.

The variables and their values(to start off with).
Code:
Dim array1 As Integer = Integer.Parse(array1.Count - 1) '''' = 5
Dim array2 As Integer = Integer.Parse(array2.Count - 1) '''' = 4
Dim array3 As Integer = Integer.Parse(array3.Count - 1) '''' = 4
Dim array4 As Integer = Integer.Parse(array4.Count - 1) '''' = 4

So from the variables I have now I need to check them all and then find which one to add onto. So with the variables values I have set I need to add onto the array2. But for some reason I can't seem to do it. I've tried doing alot of things and this is what I have come up with so far however it is just choosing array1 everytime :frown:

Code:
If array1 - array2 = 1 Then
            array2.Add("")
            Return "1"
        ElseIf array2 - array3 = 1 Then
            array3.Add("")
            Return "3"
        ElseIf array3 - array4 = 1 Then
            array4.Add("")
            Return "4"
        ElseIf array1 = array4 Then
            array1.Add("")
            Return "0"
        Else
            Return "4"
        End If

Does anyone know how I could do this? :|
 
ActionScript

ActionScript

XG R4PiDzZ
Grizzled Veteran Programmer Modder
Messages
2,649
Reaction score
1,405
Points
475
Sin$
0
So I'm trying to pick from a selections of variables depending on their value.

The variables and their values(to start off with).
Code:
Dim array1 As Integer = Integer.Parse(array1.Count - 1) '''' = 5
Dim array2 As Integer = Integer.Parse(array2.Count - 1) '''' = 4
Dim array3 As Integer = Integer.Parse(array3.Count - 1) '''' = 4
Dim array4 As Integer = Integer.Parse(array4.Count - 1) '''' = 4

So from the variables I have now I need to check them all and then find which one to add onto. So with the variables values I have set I need to add onto the array2. But for some reason I can't seem to do it. I've tried doing alot of things and this is what I have come up with so far however it is just choosing array1 everytime :frown:

Code:
If array1 - array2 = 1 Then
            array2.Add("")
            Return "1"
        ElseIf array2 - array3 = 1 Then
            array3.Add("")
            Return "3"
        ElseIf array3 - array4 = 1 Then
            array4.Add("")
            Return "4"
        ElseIf array1 = array4 Then
            array1.Add("")
            Return "0"
        Else
            Return "4"
        End If

Does anyone know how I could do this? :|


I have no idea what you are attempting. Why don't you use List's?
 
Z61

Z61

Some times our saints are sinners
Retired
Programmer Forum Addict Odysseus' Summit
Messages
5,468
Reaction score
3,429
Points
1,042
Sin$
0
You see, this is why C# is better, people can understand what you're doing.
 
Top Bottom
Login
Register