select - Read specific line from text file, according to Checked Listbox selection number -


I want to create an application that reads a specific line from a text file and it will be displayed in a text box. The list of lines will be selected according to the number of box selection which I will do.
address it:

  Public Class Form1 Private Sub Form1_Load (ByVal this System.Object, ByVal handle as e System.EventArgs) MyBase.Load End sub Private sub Button1_Click (ByVal as the System.Object, ByVal e as System.EventArgs) handles Button1.Click to dim i i = 0 Me.CheckedListBox1.CheckedIndices.Count as integer - 1 Me.CheckedListBox1.SetItemChecked (Me.CheckedListBox1.CheckedIndices (0), false) Next I end sub Private sub Button2_Click (ByVal) handles Button2.Click so CheckedListBox1 in as the System.Object, ByVal e System.EventArgs. CheckedItems.Count & lt; & Gt; 0 then dim reader new System.IO.StreamReader (CurDir () & amp; "\" & amp; "as READ.txt") = as Dim x string As Integer Dim s "" x = 0 To CheckedListBox1.CheckedItems.Count - 1s = S & amp; "Answer" & amp; (X + 1). Toaster & amp; ")" & Amp; Checkbox 1 Checked items (x). Toasting & amp; Controls CRLF & amp; Reader Readline () & amp; Controls CRLF & amp; ControlChars.CrLf Select Next X Answer.Text = (s) Else MessageBox.Show (, "the question." "Error" _ MessageBoxButtons.OK, _ MessageBoxIcon.Information) Return End End Sub End Class Then  < / pre> 

if you say I lets check 'first, second, and fifth check listbox item, I can read other text before it, and fifth lines of text file and want to show them Is the text box.
The current code just reads sequentially 1, 2, 3 (...) in order, no matter which item I 'check'.

Every time you match your line to a selected line number, Read a line from the file to track it and just add a line in the text box. / P>


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -