# Get current position in VB.net

**URL:** <https://tech-community.robotics.abb.com/t/get-current-position-in-vb-net/1088>\
**Category:** RobotStudio\
**Created:** [March 16, 2007, 2:02pm UTC](https://tech-community.robotics.abb.com/t/get-current-position-in-vb-net/1088 "2007-03-16T14:02:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klaus](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@Klaus](https://tech-community.robotics.abb.com/u/Klaus)\
**Post date:** [March 16, 2007, 2:02pm UTC](https://tech-community.robotics.abb.com/t/get-current-position-in-vb-net/1088/1 "2007-03-16T14:02:46Z")

</div>

How do i get the current TCP position i [VB.net](http://VB.net) like the function CRobt() in rapid code

---

<div class="post-metadata">

**Author:** ![PerSvensson](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/persvensson/32/1040_2.png) [@PerSvensson](https://tech-community.robotics.abb.com/u/PerSvensson)\
**Post date:** [March 16, 2007, 3:01pm UTC](https://tech-community.robotics.abb.com/t/get-current-position-in-vb-net/1088/2 "2007-03-16T15:01:28Z")

</div>

Hi  
Something like this  
Example just writes the x value to the logg window

'VB

Public Sub Macro\_CRobt()

Dim stn As Station = Project.ActiveProject

If stn Is Nothing Then Exit Sub

Dim tool As RsToolData = stn.ActiveTask.ActiveTool

Logger.AddMessage(New LogMessage(tool.Frame.GlobalMatrix.t.x.ToString()))

End Sub

//C#

public void Macro\_CRobT()

{

Station stn = Project.ActiveProject as Station;

if (stn == null) return;

RsToolData tool = stn.ActiveTask.ActiveTool;

Logger.AddMessage(new LogMessage(tool.Frame.GlobalMatrix.t.x.ToString()));

}
