Vb.net Index was out of range !
Fermé
hassen_ben_mbarek
Messages postés
2
Date d'inscription
dimanche 20 juillet 2014
Statut
Membre
Dernière intervention
26 juillet 2014
-
20 juil. 2014 à 19:55
hassen_ben_mbarek Messages postés 2 Date d'inscription dimanche 20 juillet 2014 Statut Membre Dernière intervention 26 juillet 2014 - 26 juil. 2014 à 21:31
hassen_ben_mbarek Messages postés 2 Date d'inscription dimanche 20 juillet 2014 Statut Membre Dernière intervention 26 juillet 2014 - 26 juil. 2014 à 21:31
A voir également:
- Vb.net Index was out of range !
- Input signal out of range change settings to 1600x900-60hz - Forum Windows
- Cmdlcache out of memory ✓ - Forum jeux en ligne
- Input signal out of range - Forum Matériel & Système
- Out of memory ✓ - Forum Matériel & Système
- The requested url was rejected. please consult with your administrator. ✓ - Forum Réseaux sociaux
1 réponse
hassen_ben_mbarek
Messages postés
2
Date d'inscription
dimanche 20 juillet 2014
Statut
Membre
Dernière intervention
26 juillet 2014
26 juil. 2014 à 21:31
26 juil. 2014 à 21:31
image > http://postimg.org/image/6c6j0ytqj/
Imports System.Threading
Public Class Form1
Dim opn As OpenFileDialog
Dim sv As SaveFileDialog
Dim str As String
Dim ligne As String
Dim lst As List(Of String) = New List(Of String)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim th As New Threading.Thread(AddressOf opn_f)
th.SetApartmentState(ApartmentState.STA)
th.Start()
End Sub
Sub opn_f()
opn = New OpenFileDialog
Dim th As New Threading.Thread(AddressOf for_f)
Dim string1 As String = TextBox1.Text
Dim string2 As String = TextBox2.Text
If opn.ShowDialog = Windows.Forms.DialogResult.OK Then
str = opn.FileName
Try
FileOpen(1, str, OpenMode.Input, OpenAccess.Default)
While Not EOF(1)
ligne = LineInput(1)
lst.Add(string1 + ligne + string2)
End While
th.Start()
FileClose(1)
MsgBox("Job Done , Click Save now !")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
Sub for_f()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(AddressOf for_f))
Else
For i As Integer = 0 To lst.Count - 1
ListBox1.Items.Add(lst.Item(i))
Next
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim th As Thread = New Thread(AddressOf save)
th.SetApartmentState(ApartmentState.STA)
th.Start()
End Sub
Sub save()
sv = New SaveFileDialog
If sv.ShowDialog = Windows.Forms.DialogResult.OK Then
Try
FileOpen(1, sv.FileName, OpenMode.Binary, OpenAccess.Default)
For i As Integer = 0 To lst.Count - 1
FilePut(1, lst.Item(i) & vbCrLf)
Next
FileClose(1)
MsgBox("File Saved Successfully")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
End Class