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: Wed, 18 Jul 2007 14:50:02 -0700,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    Yankee Imperialist Dog
          2    Yankee Imperialist Dog


ObjectDataSource a little help   
I have something that works, but it only returns one row of data when i 
create an ObjectDataSource with it and bind it to a gridview so i need a 
little help with this (thanks)

as simple as it gets 
1. my class:
Imports Microsoft.VisualBasic
Public Class radioShowFiles
    Private _szFileName As String
    Public Property szFileName() As String
        Get
            Return _szFileName
        End Get
        Set(ByVal value As String)
            _szFileName = value
        End Set
    End Property
End Class
2. 
the functions that allows it to bind:
    Public Function fn_getallRadioShows() As DirectoryInfo
        Dim ri As System.IO.DirectoryInfo = New 
System.IO.DirectoryInfo("c:\websites\arlnewlook\radioshows")
        Return ri
    End Function
    Function fn_rtn() As radioShowFiles
        Dim rsf As radioShowFiles = New radioShowFiles
         Dim ri As DirectoryInfo = Me.fn_getallRadioShows
        Dim diar1 As IO.FileInfo() = ri.GetFiles()
        Dim dra As IO.FileInfo
        For Each dra In diar1
            rsf.szFileName = dra.Name
        Next
        Return rsf
    End Function
End Class
I know why it's only including the last row of data, but i am sorry to say i 
don't know what to do to change it! I know i'm very close.
THANKS!
KES
-- 
Share The Knowledge. I need all the help I can get and so do you!
Date:Wed, 18 Jul 2007 14:50:02 -0700   Author:  

RE: ObjectDataSource a little help   
revised: this one works, but i have no idea if this is the best way to do 
this!!!
(Again this is a basic no-noth'n example, but it does work)
radioShowFies: just the file name 
Imports Microsoft.VisualBasic
Public Class radioShowFiles
    Sub New()

    End Sub
    Sub New(ByVal p_FileName As String)
        Me.szFileName = p_FileName
    End Sub
    Private _szFileName As String
    Public Property szFileName() As String
        Get
            Return _szFileName
        End Get
        Set(ByVal value As String)
            _szFileName = value
        End Set
    End Property
End Class
------------------
Ther object that will bind to a gridview (just change thedir path and it 
should workfor you too)
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.Collections.Generic
Public Class RadioShowFunctions

    Public Function fn_getallRadioShows() As DirectoryInfo
        Dim ri As System.IO.DirectoryInfo = New 
System.IO.DirectoryInfo("c:\websites\arlnewlook\radioshows")
        Return ri
    End Function
    Function fn_rtn() As List(Of radioShowFiles)
        Dim shows As New List(Of radioShowFiles)
        Dim ri As DirectoryInfo = Me.fn_getallRadioShows
        Dim diar1 As IO.FileInfo() = ri.GetFiles()
        Dim dra As IO.FileInfo
        For Each dra In diar1
            shows.Add(New radioShowFiles(dra.Name))
        Next
        Return shows
    End Function
End Class

i really want comments on this because i have no contact with other 
programmers other than this news group!

-- 
Share The Knowledge. I need all the help I can get and so do you!


"Yankee Imperialist Dog" wrote:


> I have something that works, but it only returns one row of data when i 
> create an ObjectDataSource with it and bind it to a gridview so i need a 
> little help with this (thanks)
> 
> as simple as it gets 
> 1. my class:
> Imports Microsoft.VisualBasic
> Public Class radioShowFiles
>     Private _szFileName As String
>     Public Property szFileName() As String
>         Get
>             Return _szFileName
>         End Get
>         Set(ByVal value As String)
>             _szFileName = value
>         End Set
>     End Property
> End Class
> 2. 
> the functions that allows it to bind:
>     Public Function fn_getallRadioShows() As DirectoryInfo
>         Dim ri As System.IO.DirectoryInfo = New 
> System.IO.DirectoryInfo("c:\websites\arlnewlook\radioshows")
>         Return ri
>     End Function
>     Function fn_rtn() As radioShowFiles
>         Dim rsf As radioShowFiles = New radioShowFiles
>          Dim ri As DirectoryInfo = Me.fn_getallRadioShows
>         Dim diar1 As IO.FileInfo() = ri.GetFiles()
>         Dim dra As IO.FileInfo
>         For Each dra In diar1
>             rsf.szFileName = dra.Name
>         Next
>         Return rsf
>     End Function
> End Class
> I know why it's only including the last row of data, but i am sorry to say i 
> don't know what to do to change it! I know i'm very close.
> THANKS!
> KES
> -- 
> Share The Knowledge. I need all the help I can get and so do you!
Date:Thu, 19 Jul 2007 08:24:01 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


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