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, 08: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!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek