cancel
Showing results for 
Search instead for 
Did you mean: 

Application has stopped working B1 V9

former_member221339
Participant
0 Kudos

Hi

I have wrote a report for a customer for B1 V9 which takes some time to run as it runs lots of queries

With the customers data, running it locally it takes about 1 minute on my notebook

On the customers network they keep getting a message about the application has stopped working at various points in the program and doesn't finish

I update the message bar but wonder if it could be the form I am displaying which I am not updating which could be causing problems

We are both running B1 V9 PL8

Just wondered if anyone has had a similar problem and can suggest anything please ?

Thanks

Andy

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Andrew,

'The Application has stopped working' refers to your add on or the whole SBO Application crashed ?

You mentioned report, is it a Crystal Report or how is the report generated ?

If you suspect this is because of the time out issue, check this thread :

Regards

Edy

former_member221339
Participant
0 Kudos

Hi Edy

Not SBO, just my application

It's pure vb.net code, I am creating a report in Excel

I will check out your thread

Thanks for your help

Regards Andy

former_member221339
Participant
0 Kudos

Hi Edy

I have looked at the code sample which seems to sort it, but confused if I just use that code as it is or somehow reference my Business One form in the code

Any ideas ?

Thanks

Andy

edy_simon
Active Contributor
0 Kudos

Hi Andy,

The problem as described in thread is: when our addon is doing a long process,  the Sbo will time out and regards our addon not responding.

The solution given was to remove windows message queue.

In view of this, your form does not matter.

Just before you do your long process, start this timer to clear the windows message queue every interval. And as soon as your process stopped, destroy this timer.

It is working on application level. So no form is involved.

Regards

Edy

former_member221339
Participant
0 Kudos

Hi Edy

Ok thanks, I will give it a go

Regards Andy

former_member221339
Participant
0 Kudos

Hi

Having a bit of a problem converting the c# code in the link to vb.net

Can anyone help please?

Thanks

Andy

Timer tm = new Timer(new TimerCallback(KeepUIAlive));

tm.Change(1000 * 60, 0);

System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(OpenMyForm)); // this calls the NET form but it could be just a heavy load method.

t.TrySetApartmentState(System.Threading.ApartmentState.STA);

t.Start();

t.Join();

tm.Dispose();

public void OpenMyForm()

{

          System.Windows.Forms.Form nf = new System.Windows.Forms.Form();

          Process p = Process.GetProcessesByName("SAP Business One")[0];

          nf.ShowDialog(new MyWindow());

}

public void KeepUIAlive(object info)

{

          Timer t = (Timer)info;

          B1Connections.theAppl.RemoveWindowsMessage(SAPbouiCOM.BoWindowsMessageType.bo_WM_TIMER, true);

          t.Change(1000 * 60, 0);

}

edy_simon
Active Contributor
0 Kudos

Hi Andy,

The VB version :

The calling


        Dim oTimer As New System.Threading.Timer(New System.Threading.TimerCallback(AddressOf oTimerCallBack))

         Try

               oTimer.Change(0, 1000 * 60) 'Trigger every 60 seconds

               'Do your heavy processing here.

         Catch

          Finally

               oTimer.Dispose

          End Try     

Callback procedure


    Private Sub oTimerCallBack(ByVal State As Object)

        Try

            SBO_Application.RemoveWindowsMessage(SAPbouiCOM.BoWindowsMessageType.bo_WM_TIMER, True)

        Catch ex As Exception

            MsgBox(ex.Message)

        End Try

    End Sub

Regards

Edy

former_member221339
Participant
0 Kudos

Hi Edy

Thanks for this

Just on holiday for the rest of the week but will try it on Monday

Have a good day

Andy

former_member221339
Participant
0 Kudos

Hi Edy

Sorry for the delay, that worked fine

Many thanks

Andy

Answers (0)