1)First query: How to load line by line of textfile when keyboard up and down arrow is used
2)Second query: how to go up in the dynamic created textbox by pressing keyboard up and down arrow
What I have tried:
Public Class Form2
Private Sub openbtn_Click(sender As Object, e As EventArgs) Handles Button2.Click
'FIRST WORKING METHOD
If (OpenFileDialog1.ShowDialog = DialogResult.OK) Then
TextBox1.Text = OpenFileDialog1.FileName
End If
1)First query: How to load line by line of textfile when keyboard up and down arrow is used
For Each ln In IO.File.ReadLines(OpenFileDialog1.FileName)
Dim tb As New TextBox With {.Width = FlowLayoutPanel1.Width - 2, .Multiline = False, .Text = ln}
AddHandler tb.KeyDown, AddressOf TextBox_KeyDown
AddHandler tb.KeyUp, AddressOf TextBox_KeyUp
FlowLayoutPanel1.Controls.Add(tb)
tb.Margin = New Padding(15, 15, 15, 15)
Next
End Sub
Private Sub TextBox_KeyDown(sender As Object, e As KeyEventArgs)
If (e.KeyData = Keys.PageDown) Then
e.Handled = True
SendKeys.Send("{Tab}")
End If
End Sub
2)Second query: how to go up in the dynamic created textbox by pressing keyboard up and down arrow
Private Sub TextBox_KeyUp(sender As Object, e As KeyEventArgs)
If (e.KeyData = Keys.PageUp) Then
e.Handled = True
SendKeys.Send("{Tab}")
End If
End Sub
End Class