Conectarme a Unidad de Red Para Acceso a Datos

Embed Size (px)

Citation preview

  • 7/23/2019 Conectarme a Unidad de Red Para Acceso a Datos

    1/3

    Conectarme a Unidad de Red Para

    acceso a Datos (Leer y Escribir) En

    Carpeta de un Servidor

    Try

    Dim Ruta As String

    Dim RutaApli As String

    Dim info As System.IO.FileInfo

    Dim extension As String

    RutaApli = AppPath()

    If argarFoto = True Then

    !RutaApli

    Ruta = Path.om"ine(rutaFotos#

    Path.$etFile%ame(&ialog.File%ame))

    info = 'y.omputer.FileSystem.$etFileInfo(TxtRuta.Text)

    extension = info.xtension

    If 'y.omputer.FileSystem.Filexists(rutaFotos *+*

    Trim(TxtFi,ha.Text) extension) Then

    File.Delete(rutaFotos *+* Trim(TxtFi,ha.Text) extension)

    info = 'y.omputer.FileSystem.$etFileInfo(TxtRuta.Text)

    extension = info.xtension

    File.opy(Trim(TxtRuta.Text)# Ruta)

    'y.omputer.FileSystem.RenameFile(Ruta#

    Trim(TxtFi,ha.Text) extension)

    lseIf 'y.omputer.FileSystem.Filexists(Ruta

    Trim(TxtFi,ha.Text)) = False Then

    File.opy(Trim(TxtRuta.Text)# Ruta)

    info = 'y.omputer.FileSystem.$etFileInfo(TxtRuta.Text)

    extension = info.xtension

    'y.omputer.FileSystem.RenameFile(Ruta#

    Trim(TxtFi,ha.Text) extension)

    n& If

    info =

    'y.omputer.FileSystem.$etFileInfo(Trim(TxtRuta.Text))

    extension = info.xtension

    %ameFoto = (Trim(TxtFi,ha.Text) extension)

    File.Delete(Ruta)

    n& If

    at,h ex As x,eption

  • 7/23/2019 Conectarme a Unidad de Red Para Acceso a Datos

    2/3

    'sg-ox(ex.'essage# 'sg-oxStyle.riti,al# *rror*)

    n& Try

    El codigo para leer la foto desde el server es este:

    Try

    e,tApli = AppPath()

    o&mplea&o = Trim(TxtFi,ha.Text)

    If 'y.omputer.FileSystem.Filexists(Ser/erFotos *+*

    Trim(RutaFoto-D)) Then

    Dim image- As %e0 -itmap(%e0 -itmap((Ser/erFotos *+*

    Trim(RutaFoto-D)))# 123# 124)

    P"Foto.Image = image- !Image.FromFile(e,tApli *+*

    Trim(RutaFoto-D))

    lse

    'sg-ox(*l emplea&o no posee Foto o no se n,uentra*#

    'sg-oxStyle.Information)

    n& If

    at,h ex As x,eption

    'sg-ox(ex.'essage# 'sg-oxStyle.riti,al)

    n& Try

    donde:

    Public Serverotos !s String " #$$SER%&D'RP$otos Personal#

    Public rutaotos !s String " #$$SER%&D'RP$otos Personal#

    La carpeta otos esta en el servidor con permitos de lectura y escritura para

    cualuier usuario***

    Espero +aberme e,plicado y me puedan guiar o ayudar

    -racias

    PrivateSuborm./Load(0y%alsender !sSystem*'b1ect 0y%ale !s

    System*Event!rgs) 2andles3y0ase*Load

    ori " 45o6

    7it+List%ie8.

    *&tems*!dd(#2'L!#9 i)

    *&tems(List%ie8.*&tems*Count .)*5ag " i

    End7it+

    ;e,t

    EndSub

  • 7/23/2019 Conectarme a Unidad de Red Para Acceso a Datos

    3/3

    PrivateSubList%ie8./&temSelectionC+anged(0y%alsender !s'b1ect 0y%ale

    !s System*7indo8s*orms*List%ie8&temSelectionC+angedEvent!rgs) 2andles

    List%ie8.*&temSelectionC+anged

    &fList%ie8.*Selected&tems*Count< 45+en

    Dimint&d !s&nteger" List%ie8.*Selected&tems(4)*5ag

    3sg0o,(int&d)

    End&f

    EndSub