RE:DESPLAZAMIENTO CON STREAMREADER
Hola:
Aqui te envio este pequeño ejemplo, espero te ayude.
Notaras que HybridDic empieza desde 1 asi que el valor 0 esta siempre vacio
esto es para darle valores con los q trabajamos normalmente a partir de 1 y
no 0.
Imports System.IO
Imports System.Collections.Specialized
Public Class Form2
Dim posicion As Int32 = 0
Dim numreg As Int32
Dim hybridDic As New HybridDictionary
Dim arreglo() As String
Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnterior.Click
If posicion >= 1 Then
posicion = posicion - 1
If hybridDic.Contains(posicion) Then
arreglo = Split(hybridDic.Item(posicion), ",")
MsgBox("posicion" & " " & posicion & " " & arreglo(0))
Else
MsgBox("llegastes al principio")
End If
ElseIf posicion <= 0 Then
MsgBox("llegastes al principio")
End If
End Sub
Private Sub btnSguiente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSiguiente.Click
If posicion >= 0 And posicion < numreg Then
posicion = posicion + 1
arreglo = Split(hybridDic.Item(posicion), ",")
MsgBox("posicion" & " " & posicion & " " & arreglo(0))
ElseIf posicion = numreg Then
MsgBox("llegastes al final")
End If
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sr As New StreamReader("c:\Sample.txt")
While Not sr.EndOfStream
numreg += 1
hybridDic.Add(numreg, sr.ReadLine)
End While
sr.Close()
End Sub
End Class