Results 1 to 2 of 2

Thread: Help :)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    154

    Help :)

    Ok...
    VB Code:
    1. Dim sText As String
    2.     Dim intFileNum As Integer
    3.    
    4.     If Form3.Text1.Text = "" Then
    5.         'On Error GoTo 1 (This is very bad practice)
    6.         With CD1
    7.             .DialogTitle = "Open Name File"
    8.             .Filter = "All Supported Types|*.usr;*.txt;*.dat|"
    9.             .ShowOpen
    10.             intFileNum = FreeFile
    11.             On Error Resume Next
    12.             Open .FileName For Input As #intFileNum
    13.             While Not EOF(intFileNum)
    14.                 Input #intFileNum, sText$
    15.                 If sText$ = "" Then
    16.                     Exit Sub
    17.                 Else
    18.                     List1.AddItem sText$
    19.                     DoEvents
    20.                 End If
    21.             Wend
    22.             Close #intFileNum
    23.         End With
    24.     Else
    25.         If Check1.Value = vbChecked Then
    26.             With CD1
    27.                 .DialogTitle = "Open Name File"
    28.                 .Filter = "All Supported Types|*.usr;*.txt;*.dat|"
    29.                 .ShowOpen
    30.                 intFileNum = FreeFile
    31.                 On Error Resume Next
    32.                 Open .FileName For Input As #intFileNum
    33.                 While Not EOF(intFileNum)
    34.                     Input #intFileNum, sText$
    35.                         If sText$ = "" Then
    36.                             Exit Sub
    37.                         Else
    38.                             List1.AddItem sText$
    39.                             DoEvents
    40.                         End If
    41.                 Wend
    42.                 Close #intFileNum
    43.             End With
    44.         End If
    45.     End If
    46.     Label1.Caption = "Word's: " & List1.ListCount
    47. End Sub
    Ok in the second part of that code with the Check1.Value I want it to add "-" to the end of each name upon loading of a file(To list1).Thx guys!You guys rock

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    VB Code:
    1. Dim sText As String
    2.     Dim intFileNum As Integer
    3.    
    4.     If Form3.Text1.Text = "" Then
    5.         With CD1
    6.             .DialogTitle = "Open Name File"
    7.             .Filter = "All Supported Types|*.usr;*.txt;*.dat|"
    8.             .ShowOpen
    9.             intFileNum = FreeFile
    10.             On Error Resume Next
    11.             Open .FileName For Input As #intFileNum
    12.             While Not EOF(intFileNum)
    13.                 Input #intFileNum, sText$
    14.                 If sText$ = "" Then
    15.                     Exit Sub
    16.                 Else
    17.                     List1.AddItem sText$
    18.                     DoEvents
    19.                 End If
    20.             Wend
    21.             Close #intFileNum
    22.         End With
    23.     Else
    24.         If Check1.Value = vbChecked Then
    25.             With CD1
    26.                 .DialogTitle = "Open Name File"
    27.                 .Filter = "All Supported Types|*.usr;*.txt;*.dat|"
    28.                 .ShowOpen
    29.                 intFileNum = FreeFile
    30.                 On Error Resume Next
    31.                 Open .FileName For Input As #intFileNum
    32.                 While Not EOF(intFileNum)
    33.                     Input #intFileNum, sText$
    34.                         If sText$ = "" Then
    35.                             Exit Sub
    36.                         Else
    37.                             List1.AddItem sText$ [color="#FF00FF"]& "_"[/color]
    38.                             DoEvents
    39.                         End If
    40.                 Wend
    41.                 Close #intFileNum
    42.             End With
    43.         End If
    44.     End If
    45.     Label1.Caption = "Word's: " & List1.ListCount
    46. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width