<div dir="ltr">We are creating confusion.<br>If we want to go to the next line in case of error, use only 'Try' you do not need to check if there is an error and tell Gambas to go to the next line, because it already does so in silence.<br>Gambas is not .net or vb<br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-06-20 11:26 GMT+02:00 Adam Ant <span dir="ltr"><<a href="mailto:adamnt42@gmail.com" target="_blank">adamnt42@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>You cannot use Try If because If will always return a value.</div><div>The above posters are correct.</div><div><br></div><div>Dim Trydate as Date</div><div><br></div><div>Try Trydate=(gibberish)</div><div>If Error then</div><div>  handle it</div><div>else</div><div>  do whatever</div><div>Endif<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 20, 2018 at 5:45 PM, Mike Crean via User <span dir="ltr"><<a href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13px"><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13px"><div></div>
        <div>If it were available in Gambas I would think it would be something like</div><div><br></div><div><span><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">Try </div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">    Date(2018,13,1)<br clear="none"></div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">If Error Then</div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">    Resume Next</div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif"><br></div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">Tegards</div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">Mike </div></span><br></div><div><br></div><div><br></div>
        
        </div><div><div class="m_961763287939747992h5"><div id="m_961763287939747992m_5655180338548021051yahoo_quoted_9753112501" class="m_961763287939747992m_5655180338548021051yahoo_quoted">
            <div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a">
                
                <div>
                    On Wednesday, 20 June 2018, 4:10:05 pm AWST, Mike Crean via User <<a href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="m_961763287939747992m_5655180338548021051yiv3684850213"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13px"><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13px"><div></div>
        <div>In VB.Net it is</div><div><br clear="none"></div><div><span><span>Try </span></span></div><div><span><span>    Date(2018,13,1)</span></span><br clear="none"></div><div><span><span>If Error Resume Next</span></span></div><div><span><span><br clear="none"></span></span></div><div><span><span>This will tell it to resume at the next error without taking any other action.</span></span></div><div><span><span><br clear="none"></span></span></div><div><span><span>Regards</span></span></div><div><span><span>Mike </span></span></div><div><br clear="none"></div>
        
        </div><div class="m_961763287939747992m_5655180338548021051yiv3684850213yahoo_quoted" id="m_961763287939747992m_5655180338548021051yiv3684850213yahoo_quoted_9988814564">
            <div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a">
                
                <div class="m_961763287939747992m_5655180338548021051yiv3684850213yqt4527459630" id="m_961763287939747992m_5655180338548021051yiv3684850213yqtfd91242"><div>
                    On Wednesday, 20 June 2018, 3:48:06 pm AWST, Gianluigi <<a href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div id="m_961763287939747992m_5655180338548021051yiv3684850213"><div><div dir="ltr">I can not understand what you want to get.<br clear="none">Now also .net uses Try, Catch and Finally.<br clear="none">If you want to continue after the error set just try:<br clear="none">Try something<br clear="none">Try something else<br clear="none">if you want to stop set:<br clear="none">Try something<br clear="none">if error then return<br clear="none">Otherwise read here:<br clear="none"><a rel="nofollow" shape="rect" href="http://gambaswiki.org/wiki/comp/gb/error" target="_blank">http://gambaswiki.org/wiki/com<wbr>p/gb/error</a><br clear="none"><br clear="none">In particular:<br clear="none">Public Sub Main()<br clear="none">  <br clear="none">  Dim x As Date<br clear="none">  <br clear="none">  Try x = Date(2018, 13, 1)<br clear="none">  If Error Then<br clear="none">    Print "Month max 12"<br clear="none">  Else<br clear="none">    Print "Exit"<br clear="none">    Return<br clear="none">  Endif<br clear="none">  <br clear="none"><div>End</div><div><br clear="none"></div><div>Regards</div><div>Gianluigi<br clear="none"></div></div><div class="m_961763287939747992m_5655180338548021051yiv3684850213gmail_extra"><br clear="none"><div class="m_961763287939747992m_5655180338548021051yiv3684850213gmail_quote">2018-06-20 0:18 GMT+02:00 Mayost Sharon <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:sharon@455.co.il" target="_blank">sharon@455.co.il</a>></span>:<br clear="none"><div class="m_961763287939747992m_5655180338548021051yiv3684850213yqt3217653495" id="m_961763287939747992m_5655180338548021051yiv3684850213yqt02076"><blockquote class="m_961763287939747992m_5655180338548021051yiv3684850213gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">OK<br clear="none">
<br clear="none">
BUT IS:<br clear="none">
<br clear="none">
Try If Date(2018,13,1) then stop<br clear="none">
<br clear="none">
---------- Original Message -----------<br clear="none">
From: Gianluigi <<a rel="nofollow" shape="rect" href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>><br clear="none">
To: Gambas Mailing List <<a rel="nofollow" shape="rect" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>><br clear="none">
Sent: Tue, 19 Jun 2018 23:52:14 +0200<br clear="none">
Subject: Re: [Gambas-user] try if error<br clear="none">
<br clear="none">
> Public Sub Main()<br clear="none">
> <br clear="none">
>   Dim i As Integer<br clear="none">
> <br clear="none">
>   Try i = "Mickey Mouse"<br clear="none">
>   Try i = "Pluto"<br clear="none">
>   Try i = "1"<br clear="none">
>   Print i<br clear="none">
> <br clear="none">
> End<br clear="none">
> <br clear="none">
> Regards<br clear="none">
> Gianluigi<br clear="none">
> <br clear="none">
> 2018-06-19 23:37 GMT+02:00 Mayost Sharon <<a rel="nofollow" shape="rect" href="mailto:sharon@455.co.il" target="_blank">sharon@455.co.il</a>>:<br clear="none">
> <br clear="none">
> > Sorry<br clear="none">
> > I meant in Visual Basic<br clear="none">
> > To skip to the next line<br clear="none">
> > There is the command<br clear="none">
> ><br clear="none">
> > On Error Resume Next<br clear="none">
> ><br clear="none">
> > In GAMBAS there is no possibility<br clear="none">
> ><br clear="none">
> ><br clear="none">
> > ---------- Original Message -----------<br clear="none">
> > From: Gianluigi <<a rel="nofollow" shape="rect" href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>><br clear="none">
> > To: Gambas Mailing List <<a rel="nofollow" shape="rect" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>><br clear="none">
> > Sent: Tue, 19 Jun 2018 23:05:47 +0200<br clear="none">
> > Subject: Re: [Gambas-user] try if error<br clear="none">
> ><br clear="none">
> > > For those who want to know what 'Goto 0' means in Vb:<br clear="none">
> > > <a rel="nofollow" shape="rect" href="https://stackoverflow.com/questions/9983464/why-would-" target="_blank">https://stackoverflow.com/ questions/9983464/why-would-</a><br clear="none">
> > you-ever-use-on-error-<br clear="none">
> > > goto-0<br clear="none">
> > ><br clear="none">
> > > Regards<br clear="none">
> > > Gianluigi<br clear="none">
> > ><br clear="none">
> > > 2018-06-19 22:54 GMT+02:00 Mayost Sharon <<a rel="nofollow" shape="rect" href="mailto:sharon@455.co.il" target="_blank">sharon@455.co.il</a>>:<br clear="none">
> > ><br clear="none">
> > > > OK<br clear="none">
> > > ><br clear="none">
> > > > Many thanks<br clear="none">
> > > ><br clear="none">
> > > > ---------- Original Message -----------<br clear="none">
> > > > From: Jussi Lahtinen <<a rel="nofollow" shape="rect" href="mailto:jussi.lahtinen@gmail.com" target="_blank">jussi.lahtinen@gmail.com</a>><br clear="none">
> > > > To: Gambas Mailing List <<a rel="nofollow" shape="rect" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>><br clear="none">
> > > > Sent: Tue, 19 Jun 2018 23:49:33 +0300<br clear="none">
> > > > Subject: Re: [Gambas-user] try if error<br clear="none">
> > > ><br clear="none">
> > > > > Dim hDate As Date<br clear="none">
> > > > ><br clear="none">
> > > > > Try hDate =Date(2018, 13, 1)<br clear="none">
> > > > ><br clear="none">
> > > > >     If Error Then<br clear="none">
> > > > >       Print "Date Error"<br clear="none">
> > > > >     Endif<br clear="none">
> > > > ><br clear="none">
> > > > >  If hDate = something Then<br clear="none">
> > > > ><br clear="none">
> > > > > ...<br clear="none">
> > > > ><br clear="none">
> > > > > Jussi<br clear="none">
> > > > ><br clear="none">
> > > > > On Tue, Jun 19, 2018 at 11:46 PM, Mayost Sharon <<a rel="nofollow" shape="rect" href="mailto:sharon@455.co.il" target="_blank">sharon@455.co.il</a>><br clear="none">
> > > > wrote:<br clear="none">
> > > > ><br clear="none">
> > > > > > This is not a good option<br clear="none">
> > > > > > Because it will send a print every time<br clear="none">
> > > > > > If the date is correct<br clear="none">
> > > > > ><br clear="none">
> > > > > > ---------- Original Message -----------<br clear="none">
> > > > > > From: Yahoo via User <<a rel="nofollow" shape="rect" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>><br clear="none">
> > > > > > To: Gambas Mailing List <<a rel="nofollow" shape="rect" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>>, Jussi<br clear="none">
> > Lahtinen<br clear="none">
> > > > > > <<a rel="nofollow" shape="rect" href="mailto:jussi.lahtinen@gmail.com" target="_blank">jussi.lahtinen@gmail.com</a>><br clear="none">
> > > > > > Cc: Yahoo <<a rel="nofollow" shape="rect" href="mailto:olivier.cruilles@yahoo.fr" target="_blank">olivier.cruilles@yahoo.fr</a>><br clear="none">
> > > > > > Sent: Tue, 19 Jun 2018 16:35:33 -0400<br clear="none">
> > > > > > Subject: Re: [Gambas-user] try if error<br clear="none">
> > > > > ><br clear="none">
> > > > > > > Better this form:<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > Try Print Date(2018, 13, 1)<br clear="none">
> > > > > > > IF Error Then<br clear="none">
> > > > > > >    Print "Wrong Date format"<br clear="none">
> > > > > > > else<br clear="none">
> > > > > > >    ‘ Do something whit your date….<br clear="none">
> > > > > > > End If<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > Cordialement,<br clear="none">
> > > > > > > —<br clear="none">
> > > > > > > Olivier Cruilles<br clear="none">
> > > > > > > Email: <a rel="nofollow" shape="rect" href="mailto:olivier.cruilles@yahoo.fr" target="_blank">olivier.cruilles@yahoo.fr</a><br clear="none">
> > > > > > ><br clear="none">
> > > > > > > Le June 19, 2018 à 16:30:03, Jussi Lahtinen (<br clear="none">
> > > > <a rel="nofollow" shape="rect" href="mailto:jussi.lahtinen@gmail.com" target="_blank">jussi.lahtinen@gmail.com</a>)<br clear="none">
> > > > > > a écrit:<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > Oh, maybe you want to use Catch structure...<br clear="none">
> > > > > > > <a rel="nofollow" shape="rect" href="http://gambaswiki.org/wiki/lang/catch" target="_blank">http://gambaswiki.org/wiki/ lang/catch</a><br clear="none">
> > > > > > ><br clear="none">
> > > > > > > Jussi<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > On Tue, Jun 19, 2018 at 11:27 PM, Jussi Lahtinen <<br clear="none">
> > > > > > <a rel="nofollow" shape="rect" href="mailto:jussi.lahtinen@gmail.com" target="_blank">jussi.lahtinen@gmail.com</a>> wrote:<br clear="none">
> > > > > > > I don't understand the problem.<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > If Error Then Goto ErrorHandling<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > ...<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > ErrorHandling:<br clear="none">
> > > > > > > Print "Here is my error handling"<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > Jussi<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > On Tue, Jun 19, 2018 at 11:22 PM, Mayost Sharon <<br clear="none">
> > <a rel="nofollow" shape="rect" href="mailto:sharon@455.co.il" target="_blank">sharon@455.co.il</a>><br clear="none">
> > > > > > wrote:<br clear="none">
> > > > > > > In Visual Basic<br clear="none">
> > > > > > > there is<br clear="none">
> > > > > > > on error goto 0<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > ---------- Original Message -----------<br clear="none">
> > > > > > > From: PICCORO McKAY Lenz <<a rel="nofollow" shape="rect" href="mailto:mckaygerhard@gmail.com" target="_blank">mckaygerhard@gmail.com</a>><br clear="none">
> > > > > > > To: Gambas Mailing List <<a rel="nofollow" shape="rect" href="mailto:user@lists.gambas-basic.org" target="_blank">user@lists.gambas-basic.org</a>><br clear="none">
> > > > > > > Sent: Tue, 19 Jun 2018 16:18:06 -0400<br clear="none">
> > > > > > > Subject: Re: [Gambas-user] try if error<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > > 2018-06-19 16:06 GMT-04:00 Mayost Sharon <<a rel="nofollow" shape="rect" href="mailto:sharon@455.co.il" target="_blank">sharon@455.co.il</a>>:<br clear="none">
> > > > > > > ><br clear="none">
> > > > > > > > > Hello<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > How do I proceed to the next line<br clear="none">
> > > > > > > > > If there is an error<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > for cases when it's error format or error of invalid date just:<br clear="none">
> > > > > > > ><br clear="none">
> > > > > > > > If Date(2018, 13, 1) Then<br clear="none">
> > > > > > > ><br clear="none">
> > > > > > > > for others error might be a good question unless compared using<br clear="none">
> > > > Comp()<br clear="none">
> > > > > > as<br clear="none">
> > > > > > > > strings!<br clear="none">
> > > > > > > ><br clear="none">
> > > > > > > > i dont know what other type of errors can be produced here!<br clear="none">
> > > > > > > ><br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > For example, if the date is not correct<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > ' Gambas module file<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > Public Sub Main()<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > >   Try Print Date(2018, 13, 1)<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > >   If Date(2018, 13, 1) Then<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > >   Endif<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > End<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > Thank you<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > > > ----[ Gambas mailing-list is hosted by<br clear="none">
> > > > <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a><br clear="none">
> > > > > > ]----<br clear="none">
> > > > > > > > ><br clear="none">
> > > > > > > ------- End of Original Message -------<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > ----[ Gambas mailing-list is hosted by<br clear="none">
> > <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a><br clear="none">
> > > > ]----<br clear="none">
> > > > > > ><br clear="none">
> > > > > > > ----[ Gambas mailing-list is hosted by<br clear="none">
> > <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a><br clear="none">
> > > > ]----<br clear="none">
> > > > > > ------- End of Original Message -------<br clear="none">
> > > > > ><br clear="none">
> > > > > ><br clear="none">
> > > > > > ----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a><br clear="none">
> > > > ]----<br clear="none">
> > > > > ><br clear="none">
> > > > ------- End of Original Message -------<br clear="none">
> > > ><br clear="none">
> > > ><br clear="none">
> > > > ----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a><br clear="none">
> > ]----<br clear="none">
> > > ><br clear="none">
> > ------- End of Original Message -------<br clear="none">
> ><br clear="none">
> ><br clear="none">
> > ----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a> ]----<br clear="none">
> ><br clear="none">
------- End of Original Message -------<br clear="none">
<br clear="none">
<br clear="none">
----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a> ]----<br clear="none">
</blockquote></div></div><br clear="none"></div></div></div><div class="m_961763287939747992m_5655180338548021051yiv3684850213yqt3217653495" id="m_961763287939747992m_5655180338548021051yiv3684850213yqt90614"><br clear="none">----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net </a>]----<br clear="none"></div></div>
            </div></div><div class="m_961763287939747992m_5655180338548021051yiv3684850213yqt4527459630" id="m_961763287939747992m_5655180338548021051yiv3684850213yqtfd12549">
        </div></div></div></div></div><div class="m_961763287939747992m_5655180338548021051yqt4527459630" id="m_961763287939747992m_5655180338548021051yqtfd17402"><br clear="none">----[ Gambas mailing-list is hosted by <a shape="rect" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net </a>]----<br clear="none"></div></div>
            </div>
        </div></div></div></div></div><br><br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
<br></blockquote></div><br></div>
<br><br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
<br></blockquote></div><br></div>