Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Visual Basic (https://www.askmehelpdesk.com/forumdisplay.php?f=469)
-   -   ListBox problem (https://www.askmehelpdesk.com/showthread.php?t=234239)

  • Jul 5, 2008, 09:30 PM
    emjez15
    ListBox problem
    If lstSchedule.Items.Contains((0)) = True Then
    objWriter.WriteLine((0))
    End If
    If lstSchedule.Items.Contains((1)) = True Then
    objWriter.WriteLine((1))

    -----------------------until objWriter.WriteLine((7))---------------------

    is this correct?. because I want want the program to write if the line 1 or to line 7 exists inside the listbox, so if there's noting written in a certain line, it just bypass and continue with the code..

    I already tried this..

    If lstSchedule.Items.Contains( lstSchedule.Items(1)) = True Then objWriter.WriteLine(( lstSchedule.Items(1))

    [UNTIL ( lstSchedule.Items(7))]

    but it just continue when line 1 or to line 7 has an input..
    I want to bypass the code line if there's no input..

    thanks in advance

    :rolleyes:
  • Jul 25, 2008, 09:37 AM
    melondotnet
    Okay,

    Use a for, for starters (like the pun? )

    For val = 1 to 7
    ~~YOUR CHECK CODE HERE~~
    Next

    This will just keep running until val = 7.

  • All times are GMT -7. The time now is 12:20 AM.