# Addin for RS 5.x (VB) problem

**URL:** <https://tech-community.robotics.abb.com/t/addin-for-rs-5-x-vb-problem/798>\
**Category:** RobotStudio\
**Created:** [August 2, 2006, 3:30pm UTC](https://tech-community.robotics.abb.com/t/addin-for-rs-5-x-vb-problem/798 "2006-08-02T15:30:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexLu](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@AlexLu](https://tech-community.robotics.abb.com/u/AlexLu)\
**Post date:** [August 2, 2006, 3:30pm UTC](https://tech-community.robotics.abb.com/t/addin-for-rs-5-x-vb-problem/798/1 "2006-08-02T15:30:46Z")

</div>

Since our add-ins for RS 3.2 were written by VB, we plan to use [VB.net](http://VB.net) as the developement tool. I wrote some codes to imitate the C# code. However, I do not see any add-in in RS 5.0. It would be greatly appreciated if anyone could help me fix the bug.

Imports System  
Imports ABB.Robotics.RobotStudio  
Imports ABB.Robotics.RobotStudio.Environment  
Imports ABB.Robotics.RobotStudio.Stations  
Imports System.Windows.Forms

Namespace MyAddinVB  
Public Class MyAddinVB  
‘’'

#Implements the constructor for the Add-in object. Place your initialization code within this method.  
Public Sub New()  
End Sub  
'\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*  
’ This method is called when RS starts  
Public Sub AddinMain()  
’ Create a new command button  
Dim Buttonfiltered= New CommandBarButton(“HelloMyAddinVB”, “Hello MyAddin VB!”)  
’ Add the button to the “Tools” menu  
’ The IDs of predefined menus and commands are found in “RobotStudioIDSummary.html”  
’  
CommandBarPopup.FromID(“MenuTools”).Controls.Add(Butto n)

’ Connect the command events  
’ C# Code  
'Button.UpdateCommandUI += New UpdateCommandUIEventHandler(button\_UpdateCommandUI)  
'Button.ExecuteCommand += New ExecuteCommandEventHandler(button\_ExecuteCommand)  
'VB Code  
AddHandler Button.UpdateCommandUI, AddressOf button\_UpdateCommandUI  
AddHandler Button.ExecuteCommand, AddressOf button\_ExecuteCommand

End Sub  
Public Sub button\_UpdateCommandUI(ByVal sender As Object, ByVal e As UpdateCommandUIEventArgs)  
’ // Enable the button  
e.Enabled = True  
End Sub

Public Sub button\_ExecuteCommand(ByVal sender As Object, ByVal e As ExecuteCommandEventArgs)  
’ // Do something  
MessageBox.Show(“Hello MyAddin VB!”)  
End Sub

'\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
End Class

End Namespace

---

<div class="post-metadata">

**Author:** ![AlexLu](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@AlexLu](https://tech-community.robotics.abb.com/u/AlexLu)\
**Post date:** [August 2, 2006, 4:51pm UTC](https://tech-community.robotics.abb.com/t/addin-for-rs-5-x-vb-problem/798/2 "2006-08-02T16:51:27Z")

</div>

I got it.

Imports System  
Imports ABB.Robotics.RobotStudio  
Imports ABB.Robotics.RobotStudio.Environment  
Imports ABB.Robotics.RobotStudio.Stations  
Imports System.Windows.Forms  
Namespace MyAddin  
Public Class MyAddin  
Public Shared Sub AddinMain()  
Dim button As CommandBarButton = New CommandBarButton(“HelloMyAddinVB”, “Hello MyAddinVB!”)  
CommandBarPopup.FromID(“MenuTools”).Controls.Add(button)  
AddHandler button.UpdateCommandUI, AddressOf button\_UpdateCommandUI  
AddHandler button.ExecuteCommand, AddressOf button\_ExecuteCommand  
End Sub  
Shared Sub button\_UpdateCommandUI(ByVal sender As Object, ByVal e As UpdateCommandUIEventArgs)  
e.Enabled = True  
End Sub  
Shared Sub button\_ExecuteCommand(ByVal sender As Object, ByVal e As ExecuteCommandEventArgs)  
MessageBox.Show(“Hello MyAddinVB!”)  
End Sub  
End Class  
End Namespace
