<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setsystemvariable USERS1-5 in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991014#M77842</link>
    <description>Thanks for the suggestions guys. Yes Tony, I know that the USERS/R/I variables are document session specific and that they are not saved with the drawing. The problem is in the same session (in fact while debugging).&lt;BR /&gt;
&lt;BR /&gt;
I am using AutoCAD Mechanical 2007 SP1 and have created a form with a button, two text boxes and a cancel button.&lt;BR /&gt;
&lt;BR /&gt;
Code follows:&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports ADApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
Public Class frmMain&lt;BR /&gt;
&lt;BR /&gt;
    Private Sub btnUsers1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUsers1.Click&lt;BR /&gt;
        Dim txtU1 As String = txtUsers1.Text&lt;BR /&gt;
        ADApp.SetSystemVariable("USERS1", txtU1)&lt;BR /&gt;
        Dim txtU1a As String = ADApp.GetSystemVariable("USERS1")&lt;BR /&gt;
        txtGetUsers1.Text = txtU1a&lt;BR /&gt;
&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
I used the txtU1 and txtU1as variables to simply see what was happening during debug. I still get nothing returned in the USERS1 variable.</description>
    <pubDate>Thu, 14 Jun 2007 13:55:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-06-14T13:55:12Z</dc:date>
    <item>
      <title>Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1990999#M77827</link>
      <description>Following a previous post about system variables, I can't seem to set and get the USERS variables.&lt;BR /&gt;
&lt;BR /&gt;
With the imports statement:&lt;BR /&gt;
Imports AcadApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
I am trying to:&lt;BR /&gt;
        AcadApp.SetSystemVariable("USERS5", "bwa")&lt;BR /&gt;
but it doesn't seem to be working.&lt;BR /&gt;
&lt;BR /&gt;
        AcadApp.SetSystemVariable("USERI5", 5)&lt;BR /&gt;
works without issue so I'm guessing that I'm not formating the string properly.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone provide assistance?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Mon, 11 Jun 2007 17:44:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1990999#M77827</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-11T17:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991000#M77828</link>
      <description>This line works for me.&lt;BR /&gt;
&lt;BR /&gt;
Application.SetSystemVariable("USERS2", strLevel)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards - Nathan</description>
      <pubDate>Mon, 11 Jun 2007 22:47:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991000#M77828</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-11T22:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991001#M77829</link>
      <description>Nathan,&lt;BR /&gt;
Thanks for the reply but it's still not working for me. As I pointed out I can set the USERI or USERR variables but the USERS group is really stumping me.&lt;BR /&gt;
&lt;BR /&gt;
        Application.SetSystemVariable("USERI5", 45)&lt;BR /&gt;
        Application.SetSystemVariable("USERR5", 54.0)&lt;BR /&gt;
will work, but&lt;BR /&gt;
        Application.SetSystemVariable("USERS1", "temp")&lt;BR /&gt;
will not work.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Bernie</description>
      <pubDate>Tue, 12 Jun 2007 13:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991001#M77829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T13:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991002#M77830</link>
      <description>Hi.&lt;BR /&gt;
&lt;BR /&gt;
Try using an object like this :&lt;BR /&gt;
&lt;BR /&gt;
object value = 45;&lt;BR /&gt;
Application.SetSystemVariable("USERS1", value);&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Peter&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5623395@discussion.autodesk.com...&lt;BR /&gt;
Nathan,&lt;BR /&gt;
Thanks for the reply but it's still not working for me. As I pointed out I &lt;BR /&gt;
can set the USERI or USERR variables but the USERS group is really stumping &lt;BR /&gt;
me.&lt;BR /&gt;
&lt;BR /&gt;
        Application.SetSystemVariable("USERI5", 45)&lt;BR /&gt;
        Application.SetSystemVariable("USERR5", 54.0)&lt;BR /&gt;
will work, but&lt;BR /&gt;
        Application.SetSystemVariable("USERS1", "temp")&lt;BR /&gt;
will not work.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Bernie&lt;/BOWA&gt;</description>
      <pubDate>Tue, 12 Jun 2007 14:23:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991002#M77830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T14:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991003#M77831</link>
      <description>Peter, thanks for the response...&lt;BR /&gt;
&lt;BR /&gt;
I'm doing this in VB and have tried both&lt;BR /&gt;
&lt;BR /&gt;
        Application.SetSystemVariable("USERS1", CObj("temp"))&lt;BR /&gt;
        Application.SetSystemVariable("USERS1", CType("temp", Object))&lt;BR /&gt;
&lt;BR /&gt;
Neither form will work for me. Also, neither the USERI or USERR variables require the value to be converted to an object.&lt;BR /&gt;
&lt;BR /&gt;
Obviously, I'm a newbie here. Am I missing something really obvious in my Imports or something?</description>
      <pubDate>Tue, 12 Jun 2007 14:40:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991003#M77831</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T14:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991004#M77832</link>
      <description>It works for me in C# if I use a stringvalue,&lt;BR /&gt;
&lt;BR /&gt;
object value = "45";&lt;BR /&gt;
Application.SetSystemVariable("USERS1", value);&lt;BR /&gt;
&lt;BR /&gt;
It should work in VB too.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5623526@discussion.autodesk.com...&lt;BR /&gt;
Peter, thanks for the response...&lt;BR /&gt;
&lt;BR /&gt;
I'm doing this in VB and have tried both&lt;BR /&gt;
&lt;BR /&gt;
        Application.SetSystemVariable("USERS1", CObj("temp"))&lt;BR /&gt;
        Application.SetSystemVariable("USERS1", CType("temp", Object))&lt;BR /&gt;
&lt;BR /&gt;
Neither form will work for me. Also, neither the USERI or USERR variables &lt;BR /&gt;
require the value to be converted to an object.&lt;BR /&gt;
&lt;BR /&gt;
Obviously, I'm a newbie here. Am I missing something really obvious in my &lt;BR /&gt;
Imports or something?&lt;/BOWA&gt;</description>
      <pubDate>Tue, 12 Jun 2007 15:34:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991004#M77832</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T15:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991005#M77833</link>
      <description>Not working for me!&lt;BR /&gt;
&lt;BR /&gt;
Getsystemvariable works:&lt;BR /&gt;
LY_Order = Application.GetSystemVariable("USERS3")&lt;BR /&gt;
but not set.&lt;BR /&gt;
&lt;BR /&gt;
I've gone to using Interop with:&lt;BR /&gt;
        Dim acadApp2 As Autodesk.AutoCAD.Interop.AcadApplication&lt;BR /&gt;
        acadApp2 = GetObject(, "AutoCAD.Application")&lt;BR /&gt;
        acadApp2.ActiveDocument.SetVariable("USERS1", CObj(LY_FR))&lt;BR /&gt;
&lt;BR /&gt;
This works but I was trying to get rid of the Interop reference&lt;BR /&gt;
&lt;BR /&gt;
If anyone has an answer, I'd still be really interested in hearing it!</description>
      <pubDate>Tue, 12 Jun 2007 15:52:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991005#M77833</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T15:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991006#M77834</link>
      <description>Are you converting to an object when you call the &lt;BR /&gt;
Application.SetSystemVariable?&lt;BR /&gt;
Have you tried to create the object variable and set the value first and &lt;BR /&gt;
then use it when you call Application.SetSystemVariable?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5623607@discussion.autodesk.com...&lt;BR /&gt;
Not working for me!&lt;BR /&gt;
&lt;BR /&gt;
Getsystemvariable works:&lt;BR /&gt;
LY_Order = Application.GetSystemVariable("USERS3")&lt;BR /&gt;
but not set.&lt;BR /&gt;
&lt;BR /&gt;
I've gone to using Interop with:&lt;BR /&gt;
        Dim acadApp2 As Autodesk.AutoCAD.Interop.AcadApplication&lt;BR /&gt;
        acadApp2 = GetObject(, "AutoCAD.Application")&lt;BR /&gt;
        acadApp2.ActiveDocument.SetVariable("USERS1", CObj(LY_FR))&lt;BR /&gt;
&lt;BR /&gt;
This works but I was trying to get rid of the Interop reference&lt;BR /&gt;
&lt;BR /&gt;
If anyone has an answer, I'd still be really interested in hearing it!&lt;/BOWA&gt;</description>
      <pubDate>Tue, 12 Jun 2007 16:04:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991006#M77834</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T16:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991007#M77835</link>
      <description>Yes, I've tried it multiple ways, including:&lt;BR /&gt;
&lt;BR /&gt;
        Dim temp As Object = CObj(LY_Order)&lt;BR /&gt;
        Application.SetSystemVariable("USERS3", temp)&lt;BR /&gt;
&lt;BR /&gt;
and&lt;BR /&gt;
         Application.SetSystemVariable("USERS3", CObj(LY_Order))&lt;BR /&gt;
&lt;BR /&gt;
and&lt;BR /&gt;
Application.SetSystemVariable("USERS3", CType(LY_Order, Object))&lt;BR /&gt;
&lt;BR /&gt;
None of these variations will work</description>
      <pubDate>Tue, 12 Jun 2007 16:22:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991007#M77835</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T16:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991008#M77836</link>
      <description>Just for the sake of it, have you tried to create the variable like this &lt;BR /&gt;
just to be sure :&lt;BR /&gt;
&lt;BR /&gt;
Dim temp As Object = "123"&lt;BR /&gt;
Application.SetSystemVariable("USERS3", temp)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5623614@discussion.autodesk.com...&lt;BR /&gt;
Yes, I've tried it multiple ways, including:&lt;BR /&gt;
&lt;BR /&gt;
        Dim temp As Object = CObj(LY_Order)&lt;BR /&gt;
        Application.SetSystemVariable("USERS3", temp)&lt;BR /&gt;
&lt;BR /&gt;
and&lt;BR /&gt;
         Application.SetSystemVariable("USERS3", CObj(LY_Order))&lt;BR /&gt;
&lt;BR /&gt;
and&lt;BR /&gt;
Application.SetSystemVariable("USERS3", CType(LY_Order, Object))&lt;BR /&gt;
&lt;BR /&gt;
None of these variations will work&lt;/BOWA&gt;</description>
      <pubDate>Tue, 12 Jun 2007 17:03:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991008#M77836</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T17:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991009#M77837</link>
      <description>Just tried it with no luck. In AutoCAD, the variable continues to be an empty string. ("")</description>
      <pubDate>Tue, 12 Jun 2007 17:14:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991009#M77837</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T17:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991010#M77838</link>
      <description>Very strange.&lt;BR /&gt;
Hope someone with experience of VB.NET can help you.&lt;BR /&gt;
&lt;BR /&gt;
Good luck...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5623767@discussion.autodesk.com...&lt;BR /&gt;
Just tried it with no luck. In AutoCAD, the variable continues to be an &lt;BR /&gt;
empty string. ("")&lt;/BOWA&gt;</description>
      <pubDate>Tue, 12 Jun 2007 17:21:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991010#M77838</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T17:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991011#M77839</link>
      <description>I do not use VB.NET to do my development.&lt;BR /&gt;
&lt;BR /&gt;
However, I did a test with VB after seeing your post.&lt;BR /&gt;
&lt;BR /&gt;
Here is the simple code and it worked as expected:&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
&lt;BR /&gt;
Imports ADApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
Public Class WDSGClass&lt;BR /&gt;
&lt;BR /&gt;
' Define command 'Asdkcmd1'&lt;BR /&gt;
&lt;BR /&gt;
&lt;COMMANDMETHOD&gt; _&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Asdkcmd1()&lt;BR /&gt;
&lt;BR /&gt;
' Type your code here&lt;BR /&gt;
&lt;BR /&gt;
ADApp.SetSystemVariable("USERS1", "1234567890A")&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
After "NetLoad" the DLL and run the command "VBCMD", I called (getvar &lt;BR /&gt;
"USERS1") at Acad command line. I got correct USERS1 value: "1234567890A".&lt;BR /&gt;
&lt;BR /&gt;
I use Acad2006 and VS2005.&lt;BR /&gt;
&lt;BR /&gt;
I am sure it works with C#, as other replies have confirmed.&lt;BR /&gt;
&lt;BR /&gt;
So, it must be your other code causes the issue. You may want to look into &lt;BR /&gt;
it harder or post your entire related code snippet. I'd not go too far by &lt;BR /&gt;
trying re-install Acad/VS...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5622523@discussion.autodesk.com...&lt;BR /&gt;
Following a previous post about system variables, I can't seem to set and &lt;BR /&gt;
get the USERS variables.&lt;BR /&gt;
&lt;BR /&gt;
With the imports statement:&lt;BR /&gt;
Imports AcadApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
I am trying to:&lt;BR /&gt;
        AcadApp.SetSystemVariable("USERS5", "bwa")&lt;BR /&gt;
but it doesn't seem to be working.&lt;BR /&gt;
&lt;BR /&gt;
        AcadApp.SetSystemVariable("USERI5", 5)&lt;BR /&gt;
works without issue so I'm guessing that I'm not formating the string &lt;BR /&gt;
properly.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone provide assistance?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;/BOWA&gt;&lt;/COMMANDMETHOD&gt;</description>
      <pubDate>Tue, 12 Jun 2007 18:54:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991011#M77839</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-12T18:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991012#M77840</link>
      <description>Are you trying this as an isolated test or part of some other code which could have another problem that is causing the sysvar to get reset? IOW, make sure your test is as simple as possible to eliminate any other possible causes.</description>
      <pubDate>Tue, 12 Jun 2007 21:56:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991012#M77840</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2007-06-12T21:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991013#M77841</link>
      <description>Perhaps the part you are not telling us, is that you are&lt;BR /&gt;
finding that the value of the system variable is an empty &lt;BR /&gt;
string, after saving and reopening the drawing?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5622523@discussion.autodesk.com...&lt;BR /&gt;
Following a previous post about system variables, I can't seem to set and get the USERS variables.&lt;BR /&gt;
&lt;BR /&gt;
With the imports statement:&lt;BR /&gt;
Imports AcadApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
I am trying to:&lt;BR /&gt;
        AcadApp.SetSystemVariable("USERS5", "bwa")&lt;BR /&gt;
but it doesn't seem to be working.&lt;BR /&gt;
&lt;BR /&gt;
        AcadApp.SetSystemVariable("USERI5", 5)&lt;BR /&gt;
works without issue so I'm guessing that I'm not formating the string properly.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone provide assistance?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;/BOWA&gt;</description>
      <pubDate>Wed, 13 Jun 2007 03:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991013#M77841</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-13T03:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991014#M77842</link>
      <description>Thanks for the suggestions guys. Yes Tony, I know that the USERS/R/I variables are document session specific and that they are not saved with the drawing. The problem is in the same session (in fact while debugging).&lt;BR /&gt;
&lt;BR /&gt;
I am using AutoCAD Mechanical 2007 SP1 and have created a form with a button, two text boxes and a cancel button.&lt;BR /&gt;
&lt;BR /&gt;
Code follows:&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports ADApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
Public Class frmMain&lt;BR /&gt;
&lt;BR /&gt;
    Private Sub btnUsers1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUsers1.Click&lt;BR /&gt;
        Dim txtU1 As String = txtUsers1.Text&lt;BR /&gt;
        ADApp.SetSystemVariable("USERS1", txtU1)&lt;BR /&gt;
        Dim txtU1a As String = ADApp.GetSystemVariable("USERS1")&lt;BR /&gt;
        txtGetUsers1.Text = txtU1a&lt;BR /&gt;
&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
I used the txtU1 and txtU1as variables to simply see what was happening during debug. I still get nothing returned in the USERS1 variable.</description>
      <pubDate>Thu, 14 Jun 2007 13:55:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991014#M77842</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-14T13:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991015#M77843</link>
      <description>OK, your code is simple enough: just set it and get it immediately.&lt;BR /&gt;
&lt;BR /&gt;
I modified the code I posted previously, as following:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports ADApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
Public Class WDSGClass&lt;BR /&gt;
&lt;BR /&gt;
    &lt;COMMANDMETHOD&gt; _&lt;BR /&gt;
    Public Sub Asdkcmd1()&lt;BR /&gt;
&lt;BR /&gt;
        ' Set USERS1&lt;BR /&gt;
        ADApp.SetSystemVariable("USERS1", "A1234567890A")&lt;BR /&gt;
&lt;BR /&gt;
        ' Get USER1&lt;BR /&gt;
        Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage &lt;BR /&gt;
_&lt;BR /&gt;
        ("Here is USERS1: " &amp;amp; ADApp.GetSystemVariable("USERS1"))&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It worked, of course, on both of my Acad2006 and Acad2007, to be precise, &lt;BR /&gt;
Acad2006/7 MAP 3D.&lt;BR /&gt;
&lt;BR /&gt;
So, I really do not know what problem is with your Acad. Does your other &lt;BR /&gt;
code run OK? You may have bad luck of gettiing a "weird copy" of Acad, that &lt;BR /&gt;
is all I can say, if nothing can solve it.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BOWA&gt; wrote in message news:5626215@discussion.autodesk.com...&lt;BR /&gt;
Thanks for the suggestions guys. Yes Tony, I know that the USERS/R/I &lt;BR /&gt;
variables are document session specific and that they are not saved with the &lt;BR /&gt;
drawing. The problem is in the same session (in fact while debugging).&lt;BR /&gt;
&lt;BR /&gt;
I am using AutoCAD Mechanical 2007 SP1 and have created a form with a &lt;BR /&gt;
button, two text boxes and a cancel button.&lt;BR /&gt;
&lt;BR /&gt;
Code follows:&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports ADApp = Autodesk.AutoCAD.ApplicationServices.Application&lt;BR /&gt;
&lt;BR /&gt;
Public Class frmMain&lt;BR /&gt;
&lt;BR /&gt;
    Private Sub btnUsers1_Click(ByVal sender As System.Object, ByVal e As &lt;BR /&gt;
System.EventArgs) Handles btnUsers1.Click&lt;BR /&gt;
        Dim txtU1 As String = txtUsers1.Text&lt;BR /&gt;
        ADApp.SetSystemVariable("USERS1", txtU1)&lt;BR /&gt;
        Dim txtU1a As String = ADApp.GetSystemVariable("USERS1")&lt;BR /&gt;
        txtGetUsers1.Text = txtU1a&lt;BR /&gt;
&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
I used the txtU1 and txtU1as variables to simply see what was happening &lt;BR /&gt;
during debug. I still get nothing returned in the USERS1 variable.&lt;/BOWA&gt;&lt;/COMMANDMETHOD&gt;</description>
      <pubDate>Thu, 14 Jun 2007 14:29:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991015#M77843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-14T14:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Setsystemvariable USERS1-5</title>
      <link>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991016#M77844</link>
      <description>To follow up  on my earlier problems with SetSystemVariable and GetSystemVariable.&lt;BR /&gt;
&lt;BR /&gt;
I ran into a couple of problems similar to this issue. Then when I installed AutoCAD 2007 on other machines in the office and tried to run my application, I kept getting errors indicating FileNotFoundException for Autodesk.AutoCAD.Interop Version=17.1.51.0&lt;BR /&gt;
The version installed by AutoCAD 2007 is 17.0.54.0.&lt;BR /&gt;
&lt;BR /&gt;
After a lot of hair pulling, I realized that the offending DLL had been installed on my machine when I checked out TrueView2008. It appears that it installs updated copies of the DLL that broke the GetSystemVariable and SetSystemVariable functions.&lt;BR /&gt;
&lt;BR /&gt;
It also seems that it broke something in Environment.GetEnvironmentVariable("username").  I had to use AcadApp.GetSystemVariable("LOGINNAME") to get the user name.&lt;BR /&gt;
&lt;BR /&gt;
I had to uninstall TrueView, uninstall AutoCAD 2007 and reinstall AutoCAD 2007 (a repair didn't correct the DLL's) to get things working. Now that I've cleaned out TrueView, everything is working as expected.&lt;BR /&gt;
&lt;BR /&gt;
It would be nice if someone from Autodesk could verify that this is indeed the problem.</description>
      <pubDate>Fri, 29 Jun 2007 14:03:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/setsystemvariable-users1-5/m-p/1991016#M77844</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-29T14:03:29Z</dc:date>
    </item>
  </channel>
</rss>

