DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 23 Aug 2007 05:52:36 -0700,    posted on: microsoft.public.dotnet.languages.vb        back       

Thread Index
  1    cmdolcet69
          2    unknown


Help with Deleting a file   
I have the below code that calls a function to delete a file that i
added to a listview node. What happens is that that file doesn;t
delete. Please help me out. I have included the event handler and
function. Thanks


Private Sub btnDeleteReport_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDeleteReport.Click

 
_partfile.Reports.RemoveReport(Me.tvAddedReports.Nodes(0).Nodes(0).Text,
Me.tvAddedReports.Nodes(0).Nodes(0).Nodes(0).Text)

    End Sub
----------------------------------------------------------------------------------------------------------------------------------------------------------------------


Public Function RemoveReport(ByVal rPath As String, ByVal rPrinter As
String) As Integer
        Try
            Dim intloop As Integer
            For intloop = 0 To reportArray.Count - 1
                If CType(reportArray(intloop), Reports).ReportPath =
rPath And CType(reportArray(intloop), Reports).ReportPrinter =
rPrinter Then
                    reportArray.RemoveAt(intloop)
                    Exit For
                End If
            Next
            Return 0
        Catch ex As Exception
            Return -1
        End Try
    End Function
Date:Thu, 23 Aug 2007 05:52:36 -0700   Author:  

Re: Help with Deleting a file   
On Aug 23, 8:52 am, cmdolcet69  wrote:

> I have the below code that calls a function to delete a file that i
> added to a listview node. What happens is that that file doesn;t
> delete. Please help me out. I have included the event handler and
> function. Thanks
>
> Private Sub btnDeleteReport_Click(ByVal sender As System.Object, ByVal
> e As System.EventArgs) Handles btnDeleteReport.Click
>
> _partfile.Reports.RemoveReport(Me.tvAddedReports.Nodes(0).Nodes(0).Text,
> Me.tvAddedReports.Nodes(0).Nodes(0).Nodes(0).Text)
>
>     End Sub
> ---------------------------------------------------------------------------­---------------------------------------------------------------------------­----------------
>
> Public Function RemoveReport(ByVal rPath As String, ByVal rPrinter As
> String) As Integer
>         Try
>             Dim intloop As Integer
>             For intloop = 0 To reportArray.Count - 1
>                 If CType(reportArray(intloop), Reports).ReportPath =
> rPath And CType(reportArray(intloop), Reports).ReportPrinter =
> rPrinter Then
>                     reportArray.RemoveAt(intloop)
>                     Exit For
>                 End If
>             Next
>             Return 0
>         Catch ex As Exception
>             Return -1
>         End Try
>     End Function


It appears to me that it only removes the entry for the file in the
list view. To actually delete the file I believe you will need to do
a:

System.IO.File.Delete("path to file")
Date:Thu, 23 Aug 2007 06:28:32 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us