Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27034

[RESOLVED] Help with Code, PLEASE

$
0
0
I am attempting to populate a drop down from a text file, the cod is below, and I've attached a data file I'm getting the text from. Help if you can, What's happenuing is if i rem out the lower code, like you see it, the code works perfectly...
But when i un-rem the code, it will not work, no errors, it just keeps loading FDimArray (0), FDimArray (1), FDimArray (2), it won't cycle through...
I feel somewhere i need to redim the array, but i'm not sure...

Private Sub FDimensionSelect_GotFocus(sender As Object, e As System.EventArgs) Handles FDimensionSelect.GotFocus
With Me
.FDimensionSelect.Items.Clear()

Dim i As Integer
Dim FindIndex() As String = Split((TXT), vbNewLine)
For i = 0 To FindIndex.GetUpperBound(i)

If .InputOne.Text > 2.6 And VB.Left(FindIndex(i), Len("{Metric " & .FDimensionSelectLbl.Text & "s}")) = "{Metric " & .FDimensionSelectLbl.Text & "s}" Then
NewTXT = Trim(Mid(FindIndex(i), Len("{Metric " & Me.FDimensionSelectLbl.Text & "s}") + 1))
Exit For
ElseIf Me.InputOne.Text < 2.6 And VB.Left(FindIndex(i), Len("{English " & .FDimensionSelectLbl.Text & "s}")) = "{English " & .FDimensionSelectLbl.Text & "s}" Then
NewTXT = Trim(Mid(FindIndex(i), Len("{English " & .FDimensionSelectLbl.Text & "s}") + 1))
Exit For
End If
Next
'**********************************************************************************

Dim FDimensions() As String = Split(NewTXT, Seperators)

For Each FoundString As String In FDimensions
FDimArray = Split(FoundString, ",")

If .InputOne.Text > 2.6 Then
If FDimArray(0) = Val(.DiameterSelect.Text) And (FDimArray(1)) = 1 Then
.FDimensionSelect.Items.Add(Val(.DiameterSelect.Text) / 2)

ElseIf FDimArray(0) = Val(.DiameterSelect.Text) And (FDimArray(1)) = Mid(.DowelSelect.Text, 2, 1) Then
.FDimensionSelect.Items.Add(FDimArray(2))

End If
End If

*****************************************************************PROBLEM IS HERE, WHEN I UN-REM THE CODE BELOW*******************
'If .InputOne.Text < 2.6 Then

'If FDimArray(0) = Val(.DiameterSelect.Text) And (FDimArray(1)) = 1 Then
'.FDimensionSelect.Items.Add(Val(.DiameterSelect.Text) / 2)

'ElseIf FDimArray(0) = Val(.DiameterSelect.Text) And (FDimArray(1)) = Mid(.DowelSelect.Text, 2, 2) Then
' .FDimensionSelect.Items.Add(FDimArray(2))

'End If
'End If

Next


End With

End Sub
Attached Files

Viewing all articles
Browse latest Browse all 27034

Trending Articles