ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 10th, 2003, 09:04 PM
techskool techskool is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 1 techskool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
VB Control Array Nightmare

I have a main form

It has 2 lots of drive/dir/list boxes.

The first is set to Photo Albums on load

The second is set to Temp Images

I have 2 frames, a workspace and an album frame.

I have tried to write code so that the drive1/dir1/ default startup folder paints an array of folder icons to the album frame.

I have tried to write code so that the drive2/dir2/ default startup folder paints an array of images to the workspace frame.

Can anyone see any inherent problems with this code that is preventing me populate the arrays.

(The albums array works in a fashion, but the label does not load, the Workspace array does not seem to work at all)

I have tried my best, and am pretty sure this will be my last vb project, it is just too difficult for me.


Thanks for looking.

Dave

URL

(If your feeling brave you can download the project so you can see the problem - frmMain is the form in question.)















Option Explicit
Dim FolderMax As Integer, FolderCount As Integer
Dim WorkSpaceMax As Integer, WorkSpaceCount As Integer
Dim mfso As New FileSystemObject


'connect drives
Private Sub Drive1_Change()
Dir1.path = Drive1.Drive
File1.path = Dir1.path
End Sub
'connect drives
Private Sub Dir1_Change()
File1.path = Dir1.path
If File1.ListCount > 0 Then File1.ListIndex = 0
End Sub

'connect drives
Private Sub Drive2_Change()
Dir2.path = Drive2.Drive
File2.path = Dir2.path
End Sub
'connect drives
Private Sub Dir2_Change()
File2.path = Dir2.path
If File2.ListCount > 0 Then File2.ListIndex = 0
End Sub


Private Sub Form_Load()
'check for main project file for all albums, if it doesnt exist, create it.
Dim fso As FileSystemObject
Dim strFolder As String
Set fso = New FileSystemObject
strFolder = "c:\Photo_Albums"
If fso.FolderExists(strFolder) = False Then
fso.createfolder strFolder
End If
Set fso = New FileSystemObject
strFolder = "c:\Temp_Images"
If fso.FolderExists(strFolder) = False Then
fso.createfolder strFolder
End If
Set fso = Nothing

Dir1.path = "c:\Photo_Albums"
Dir2.path = "c:\Temp_Images"

'************************************************* ***************
'load album array size and layout
Dim i As Integer
FolderMax = 20
For i = 1 To FolderMax - 1
Load imgFolder(i)
imgFolder(i).Left = 120 + (i Mod 5) * 720
imgFolder(i).Top = 120 + (i \ 5) * 960
imgFolder(i).Visible = False
Load lblFilename(i)
lblFilename(i).Left = 120 + (i Mod 5) * 720
lblFilename(i).Top = 720 + (i \ 5) * 960
lblFilename(i).Visible = False
Next i
'************************************************* ***************

'************************************************* ***************
'load workspace array size and layout
Dim ii As Integer
WorkSpaceMax = 20
For ii = 1 To WorkSpaceMax - 1

Load imgWorkspace(ii)
imgWorkspace(ii).Left = 120 + (ii Mod 5) * 720
imgWorkspace(ii).Top = 120 + (ii \ 5) * 960
imgWorkspace(ii).Visible = False
Load lblFilenameW(ii)
lblFilenameW(ii).Left = 120 + (ii Mod 5) * 720
lblFilenameW(ii).Top = 720 + (ii \ 5) * 960
lblFilenameW(ii).Visible = False
Next ii
'************************************************* ***************

'button disable, delete / of files and folders
cmdDelAlb.Enabled = False
cmdDelImg.Enabled = False

End Sub

'************************************************* ***************
Private Sub imgFolder_Click(Index As Integer)
'Folder Array
Dim ii As Integer
FolderCount = Dir1.ListCount
If FolderCount > FolderMax Then FolderCount = FolderMax
For ii = 0 To FolderCount - 1
' Put the name in the label below the icon
lblFilename(ii).Caption = Dir$(Dir1.List(ii))
' Make them both visible
imgFolder(ii).Visible = True
lblFilename(ii).Visible = True
Next ii
' Now make all the other image controls invisible
For ii = FolderCount To FolderMax - 1
imgFolder(ii).Visible = False
lblFilename(ii).Visible = False
Next ii
End Sub
'************************************************* ***************

'************************************************* ***************
Private Sub imgWorkSpace_Click(Index As Integer)
'WorkSpace Array
Dim ii As Integer
WorkSpaceCount = File2.ListCount
If WorkSpaceCount > WorkSpaceMax Then WorkSpaceCount = WorkSpaceMax
For ii = 0 To WorkSpaceCount - 1
imgWorkspace(ii).Picture = LoadPicture(File2.List(ii))
' Put the name in the label below the icon
lblFilenameW(ii).Caption = Dir$(Dir1.List(ii))
' Make them both visible
imgWorkspace(ii).Visible = True
lblFilenameW(ii).Visible = True
Next ii
' Now make all the other image controls invisible
For ii = WorkSpaceCount To WorkSpaceMax - 1
imgWorkspace(ii).Visible = False
lblFilenameW(ii).Visible = False
Next ii
End Sub
'************************************************* ***************

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > VB Control Array Nightmare


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT