Solved

Manging array of controls

Posted on 2007-11-29
10
203 Views
Last Modified: 2010-04-30
Hello

i have a problem as follow:
i created an array of command buttons. their index are from 0 to 4. i remove one of them with index 3 using code (unload buttons(3)). i want to make the index of button(4) =3 and index of Button(5)=4. how can i do that. i want that because in every for loop this make a problem to me with the missing item.

regards
0
Comment
Question by:aft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 20372382
i think you need to resize the array

ReDim Preserve avRemoveFrom(lLBound To lUbound - 1)

Take a look at http://www.visualbasic.happycodings.com/API_and_Miscellaneous/code37.html
0
 

Author Comment

by:aft
ID: 20372409
no this is not what i want
i have an array of buttons in my case
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 20372424
Perhaps you should recreate your array of buttons and leave that button out of the array
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:aft
ID: 20372465
i want more easy solution
because it is too hard too do that in my application. i hide many details about my application here for simplicity
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 20373073
Perhaps you could just hide the control and not delete it.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 20374637
"i want that because in every for loop this make a problem to me with the missing item."

Use Error Handling (On Error Goto xxx/Resume yyy) to trap the error generated by the "hole" in your control array.  This will allow you to skip over the indexes that have had the control unloaded...


0
 

Author Comment

by:aft
ID: 20387241
no the problem is more complicated than that
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 20387265
The Index() property of a standard control array is read-only...so the only way to do this is to physically cycle thru the controls and copy all of the properties to the new position...and then unloading the last item in the array.

Other than that suggestion, we would need to no want you are ACTUALLY doing....please explain what "complicated" means.
0
 

Author Comment

by:aft
ID: 20387289
ok

i have a video transmission program that work as follows:
1. each user has a server program that read the video frames from the camera it is connected to his local computer.
2. i have the client program on my computer that has a list control containing all the users. when i click each user, the program create a window that render the video from the clicked server. when i uncheck the user, its window removed and the windows after it shifts one step up
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 20387294
So is it a matter of correctly correlating the ListBox entry with the correct connection (Winsock control array?) after an entry has been removed from the middle of the "user list"?

Are we dealing with Winsock control arrays?
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month3 days, 21 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question