RobotStudio event

Graphics in Flex pendant

Options

Hello,
I'm testing the RAB in order to make some drawings on the FP    for  our  next  Open House
this is a simple example.
When you click button1 , it draws a line.
It works fine in the VIRC5, but when I deploy it to the robot I get an exception on button1_Click image
This is the code

Private
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myGraphics As Graphics
Dim myPen As Pen
myPen =
New Pen(Color.Red)
myGraphics =
Me.PictureBox1.CreateGraphics()
myGraphics.DrawLine(myPen, 10, 10, 50, 50)
End Sub
Is the system.drwing.graphics supported by the FP?Is there a different way to work?
Here  there is  also  the    complete  project:
TpsViewDrawTest.zip
 
Thanks
Oscar

 

BR
Oscar Ferrrato

Comments

  • RussD
    Options

    What is the message associated with the exception?

    You may want to put that code in a Try...Catch block to handle the exception and recover more gracefully. You can put the exception into a Message Box and try to format it better by incrementing a value representing the current line of code. You can then use this number as the title to an error handling dialog. For example:


    Dim shLineNum as short
    Try
    shLineNum = 157 'add your current line number in code here

    rd = ctrl.Rapid.GetRapidData(T_ROB1, MData, "m_GN_String2")
    shLineNum += 1 'increment the line counter for each line of code
    If rd Is Nothing Then
    shLineNum += 1

    strWarning = "Rapid Access Error reading variable m_GN_String2"
    shLineNum += 1
    Throw New Exception(strWarning)
    shLineNum += 1

    Else
    shLineNum += 1

    'do work here
    End If
    Catch
    ex As Exception
    'pass the line number as the title of the dialog
    'it should indicate the line where the exception was thrown
    GTPUMessageBox.Show(
    Me, _
    Nothing, _
    ex.Message, shLineNum.ToString(), _
    System.Windows.Forms.MessageBoxIcon.Asterisk, _
    System.Windows.Forms.MessageBoxButtons.OKCancel)

    Finally

    If Not rd Is Nothing Then
    rd.Dispose()
    rd =
    Nothing
    End If
    End
    TryRussD38490,6240393519
    Russell Drown
  • I have the same problem as oscar_f.

    Can any body explain this?

    Thank you in adveance.