Code Union 12

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Public Class frmUnion

Private sRuta, Archivo As String


Private Sub frmUnion_Load(sender As Object, e As EventArgs) Handles MyBase.L
oad
sRuta = My.Application.Info.DirectoryPath & "\Ejemplos"
If Not My.Computer.FileSystem.DirectoryExists(sRuta) Then
My.Computer.FileSystem.CreateDirectory(sRuta)
End If
End Sub
Private Sub btnOpenA_Click(sender As Object, e As EventArgs) Handles btnOpen
A.Click
If OpenFD.ShowDialog = Windows.Forms.DialogResult.OK Then
Archivo = OpenFD.FileName
Dim sLine As String = My.Computer.FileSystem.ReadAllText(Archivo)
ExtraerNombres(sLine, ListA, labTA)
End If
End Sub
Private Sub ExtraerNombres(ByVal sLine As String, ByRef LDestino As ListBox,
ByRef oLab As Label)
Dim x, y As Integer, sNombre As String = ""
x = InStr(sLine, ",")
y = 1
LDestino.Items.Clear()
Do While x <> 0
sNombre = Mid(sLine, y, x - y)
LDestino.Items.Add(sNombre)
y = x + 1
x = InStr(y, sLine, ",")
Loop
oLab.Text = LDestino.Items.Count
'Pendiente
End Sub
Private Sub btnOpenB_Click(sender As Object, e As EventArgs) Handles btnOpen
B.Click
If OpenFD.ShowDialog = Windows.Forms.DialogResult.OK Then
Archivo = OpenFD.FileName
Dim sLine As String = My.Computer.FileSystem.ReadAllText(Archivo)
ExtraerNombres(sLine, ListB, labTB)
End If
End Sub

You might also like