Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Cancel action if array doesn't exist


Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2004, 08:34 AM
boblav11's Avatar
boblav11 boblav11 is offline
Regular
 
Join Date: May 2004
Location: Montreal
Posts: 52
Lightbulb Cancel action if array doesn't exist


Hi, i am doing a code that check if a case is busy (the label/case is busy when another label is on it) but when the timer starts, there's just one array and there will be 30. i want to know how to tell him to goto exitline2 if the array doesn't exists
HOW?????
I've tried this code: If not Yourlabelname(x) exists Then GoTo exitline2
But vb6 doesn't recongnize "EXISTS" as vbnet does
Code:
Private Sub timbusy_Timer()
Dim x As Integer
x = -1
Do Until x = Yourlabelname.Count
x = x + 1
If Yourlabelname(x).Left = Label4(x).Left And Yourlabelname(x).Top = Label4(x).Top Then busy(x) = True
exitline2: busy(x) = False
Loop
End Sub
By the way if you think of a better way to make cases without using tonnes of labels tell me

And if you think of how to set busy(x)=false when the label leaves his current place

E-MAIL me if you want
Reply With Quote
  #2  
Old 08-04-2004, 08:38 AM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

Code:
If (Not MyArray) = -1 Then 'array does not exist
Reply With Quote
  #3  
Old 08-04-2004, 09:48 AM
boblav11's Avatar
boblav11 boblav11 is offline
Regular
 
Join Date: May 2004
Location: Montreal
Posts: 52
Default

Quote:
Originally Posted by Agent707
Code:
If (Not MyArray) = -1 Then 'array does not exist
can you explain a little bit more
don't understand
thanks
Reply With Quote
  #4  
Old 08-04-2004, 10:25 AM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

No, I don't think I can explain that any plainer.
Quote:
I've tried this code: If not Yourlabelname(x) exists Then GoTo exitline2
But vb6 doesn't recongnize "EXISTS" as vbnet does
I am assumming Yourlabelname is a control array of labels?
Code:
If (Not Yourlabelname) = -1 Then 'array does not exist GoTo exitline2 End If
Are you trying to see if the array Element exist?

It's really hard to understand what you're trying to do anyway as the code example you posted doesn't make any sense to me.
Code:
Do Until x = Yourlabelname.Count x = x + 1 If Yourlabelname(x).Left = Label4(x).Left And Yourlabelname(x).Top = Label4(x).Top Then busy(x) = True 'The following line is going to execute everytime regardless of the above lines results. ' so busy(x) will always be False exitline2: busy(x) = False Loop
I don't know what you mean by
Quote:
By the way if you think of a better way to make cases without using tonnes of labels tell me
cases of what?

I'm guessing what you're trying to do is something more like this?
Code:
Private Sub timbusy_Timer() Dim x As Integer For x = 1 To Yourlabelname.Count If Yourlabelname(x).Left = Label4(x).Left And Yourlabelname(x).Top = Label4(x).Top Then busy(x) = True Else busy(x) = False End If Next End Sub

Last edited by Agent707; 08-04-2004 at 08:25 PM.
Reply With Quote
  #5  
Old 08-04-2004, 12:16 PM
boblav11's Avatar
boblav11 boblav11 is offline
Regular
 
Join Date: May 2004
Location: Montreal
Posts: 52
Default

thanks a lot for the quick response

Code:
Load Me.Yourlabelname(x)
Me.Yourlabelname(x).Visible = True
Me.Yourlabelname(x).Move Label4(x).Left, Label4(x).Top, 975, 375
this copy an existing label with array but i cannot find the way to place vbBringtoFront help please

and if i dont bring it to front it goes behind the label4 and i cannot access to it
Reply With Quote
  #6  
Old 08-04-2004, 12:20 PM
boblav11's Avatar
boblav11 boblav11 is offline
Regular
 
Join Date: May 2004
Location: Montreal
Posts: 52
Default

Code:
Private Sub timbusy_Timer() Dim x As Integer For x = 1 To Yourlabelname.Count If (Not Yourlabelname(x)) = -1 Then GoTo exitline2: If Yourlabelname(x).Left = Label4(x).Left And Yourlabelname(x).Top = Label4(x).Top Then busy(x) = True Else busy(x) = False End If exitline2: Next End Sub
i've tried this as you tell me and still says: control array 1 doesn't exists
Reply With Quote
  #7  
Old 08-04-2004, 01:03 PM
jjStinger72's Avatar
jjStinger72 jjStinger72 is offline
Senior Contributor

Retired Leader
* Expert *
 
Join Date: Nov 2003
Location: Buffalo, NY
Posts: 1,145
Default

to bring your label to "the front" invoke the zorder method

Code:
Me.Yourlabelname(x).Zorder 0

...what is "Control Array 1". I don't see it referenced in any of your code. What error are you getting exactly??
__________________
Jay

[vb][/vb] Tags | Standards & Practices Tutorial | File I/O Tutorial | List of all these Tags
Reply With Quote
  #8  
Old 08-04-2004, 02:27 PM
boblav11's Avatar
boblav11 boblav11 is offline
Regular
 
Join Date: May 2004
Location: Montreal
Posts: 52
Default

its ok thanks
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->