can anyone help me out?

anomaly
09-29-2001, 11:03 AM
I have an array of gaphical textboxes ( for buttons ) and I have it to where you can go to the menu "talk" and click "chat" a new button is created with the name of the menu. but what I dont know is how can you unload the button? I guess I have to search all the buttons that have been created by index and then check the caption to see if its the one created but im not sure how to go about it. any help will be appriciated. thanks

Ok....it's basically visual, what about the rest?

Ad1
09-29-2001, 01:38 PM
if you mean you want to unload the last one you created then you can put
<pre>unload txtButton(txtButton.count-1)</pre>

anomaly
09-29-2001, 01:48 PM
I need it to unload a specific button, like if there are 3 windows open, theres a button for each window and I want to delete the second one how would I got about that, the index or count I would need isnt always the same because you can open the windows in any order you like

Ok....it's basically visual, what about the rest?

Ad1
09-29-2001, 01:55 PM
you could use a loop eg
<pre>for x=0 to txtButton.count-1
if txtButton.text=strCaption then <font color=green>'the caption you want</font color=green>
unload txtButton(x)
endif
next x</pre>

anomaly
09-29-2001, 02:04 PM
Option Explicit
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 0 To MDIForm1.Check1.Count - 1
If MDIForm1.Check1(x).Caption = "Chat" Then
Unload MDIForm1.Check1(x)
End If
Next i
Me.Hide
End Sub

when I ty it it says "x" is not defined, I dont know how to make the index's public I keep getting errors

Ok....it's basically visual, what about the rest?

Ad1
09-29-2001, 02:30 PM
when you use Option Explicit you must declare all your variables, also you are using i for the count in your for loop so you should change your code to
<pre>Option Explicit
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 0 To MDIForm1.Check1.Count - 1
If MDIForm1.Check1(i).Caption = "Chat" Then
Unload MDIForm1.Check1(i)
End If
Next i
Me.Hide
End Sub </pre>

anomaly
09-29-2001, 02:34 PM
yeah I JUST figured that out, MAN oh MAN should I slap myself for that one or what, lol. I love this place. I thank everyone for helping me with this.

Ok....it's basically visual, what about the rest?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum