[Gambas-user] Syntax help for IF after a Try statement
rocko
sunblaster5 at ...626...
Thu Aug 9 05:43:36 CEST 2012
The first one works.
Haven't tried the second one.
Wasn't aware of '$conn.Opened().
But it's good to know
On Thu, 2012-08-09 at 12:51 +0930, Adam Ant wrote:
> On Thu, Aug 9, 2012 at 12:35 PM, rocko <sunblaster5 at ...626...> wrote:
> > Ok if I replace the 'Else If' with an 'Else'
> > I get an error:
> > Else without If.
> > But there is an 'If' after the 'Try'.
> > unless you can't put an 'Else' after an 'Try...If'
>
> Ah! No you can't use
>
> Try If blahblahblah
>
> (and there are some other things you can't "TRY", I can't think of
> them at the moment)
>
> Be very aware of what "TRY" actually does!
>
> Oh and by the way, to test if a connection is already open, the
> function you need is
> <Connection>.Opened()
>
> So,
>
> Try $conn.Open()
> If Error then
> Print "Not Open"
> Else
> Print "Opened it!"
> End If
>
> or
>
> $conn.Open
> If $conn.Opened() then
> Print "Not Open"
> Else
> Print "Opened it!"
> End If
>
> should both work.
>
> hth
> Bruce
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list