bobbynad Posted July 10, 2004 Posted July 10, 2004 Hello , I have few problems in regard to the code below 1. The DataGrid is not displayed 2. I want to insert some data in the array and latter the array is attached to the datagrid. I am facing some errors a) at line AryFiles(FilCount) = New FileList(Fl.Name, Fl.Type, Fl.DateCreated) it shows the array out of bound. b) I tried to see the results using break point , I couldn't as it dosen't reach the breakpoint , Please let me know the process to apply break point and debug. Where am i wrong in this code Imports System.ComponentModel Public Class WebForm1 Inherits System.Web.UI.Page Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid Protected WithEvents Button1 As System.Web.UI.WebControls.Button Private AryFiles() As FileList = New FileList(1000) {} Protected WithEvents Label1 As System.Web.UI.WebControls.Label Dim FilCount As Integer #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FilCount = 0 'Put user code to initialize the page here End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click FilCount = 0 FilDisplay("C:\Documents and settings") DataGrid1.DataSource = AryFiles End Sub Private Sub FilDisplay(ByVal Str As String) Dim Fld As Scripting.Folder Dim Fl As Scripting.File Dim FSO = New Scripting.FileSystemObject() For Each Fl In FSO.getfolder(Str).files AryFiles(FilCount) = New FileList(Fl.Name, Fl.Type, Fl.DateCreated) FilCount = FilCount + 1 Next For Each Fld In FSO.getfolder(Str).subfolders FilDisplay(Str & "\" & Fld.Name) Next End Sub End Class Public Class FileList Private m_FileName As String Private m_FileType As String Private m_FileCreated As Date Public ReadOnly Property FileName() Get FileName = m_FileName End Get End Property Public ReadOnly Property FileType() Get FileType = m_FileType End Get End Property Public ReadOnly Property FileCreated() Get FileCreated = m_FileCreated End Get End Property Public Sub New(ByVal FileName As String, ByVal FileType As String, ByVal FileCreated As Date) Me.m_FileName = FileName Me.m_FileType = FileType Me.m_FileCreated = FileCreated End Sub End Class Quote
Bryan Posted July 10, 2004 Posted July 10, 2004 in the future could you put your code in my code here it makes it easier to read your code as it retains any indention and stuff. Quote
eramgarden Posted July 10, 2004 Posted July 10, 2004 didnt look at your code but this is a good datagrid site: http://aspnet.4guysfromrolla.com/articles/040502-1.aspx Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.