<?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: Mtext problem in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895578#M78920</link>
    <description>Ugh, here is my first baby steps in VB.NET...&lt;BR /&gt;
I was trying to use your code but&lt;BR /&gt;
without of luck&lt;BR /&gt;
I have Visual Studio .NET 2003 and A2005&lt;BR /&gt;
on my machine&lt;BR /&gt;
I created project with form and added your&lt;BR /&gt;
code into form class&lt;BR /&gt;
This is waht I have a got so far&lt;BR /&gt;
See attached picture&lt;BR /&gt;
What I did wrong?&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
&lt;BR /&gt;
Fatty&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
    <pubDate>Thu, 22 Feb 2007 20:34:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-02-22T20:34:51Z</dc:date>
    <item>
      <title>Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895571#M78913</link>
      <description>Hi,all.&lt;BR /&gt;
Some help?&lt;BR /&gt;
The problem is the part 'Case MTEXT' of the following code.&lt;BR /&gt;
With what should I replace MTEXT?&lt;BR /&gt;
&lt;BR /&gt;
Dim Values() As TypedValue = &lt;BR /&gt;
                     {New typedvalue(dxfCode.Start, "TEXT,MTEXT")}&lt;BR /&gt;
Dim prFilter As SelectionFilter = New SelectionFilter(Values) Dim res As PromptSelectionResult = ed.SelectAll(prFilter)&lt;BR /&gt;
&lt;BR /&gt;
Select case id.gettype.name&lt;BR /&gt;
         case Text&lt;BR /&gt;
                  ...&lt;BR /&gt;
          case Mtext&lt;BR /&gt;
                   ....&lt;BR /&gt;
End Select</description>
      <pubDate>Tue, 20 Feb 2007 19:14:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895571#M78913</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-20T19:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895572#M78914</link>
      <description>&amp;gt;  Select case id.gettype.name&lt;BR /&gt;
&lt;BR /&gt;
returns "ObjectId" if I'm not mistaken, assuming&lt;BR /&gt;
that 'id' is an ObjectId.&lt;BR /&gt;
&lt;BR /&gt;
You have to open the entity to determine what&lt;BR /&gt;
type it is.&lt;BR /&gt;
&lt;BR /&gt;
Do you know how to open the entity?&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 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;GILSEORIN&gt; wrote in message news:5493343@discussion.autodesk.com...&lt;BR /&gt;
Hi,all.&lt;BR /&gt;
Some help?&lt;BR /&gt;
The problem is the part 'Case MTEXT' of the following code.&lt;BR /&gt;
With what should I replace MTEXT?&lt;BR /&gt;
&lt;BR /&gt;
Dim Values() As TypedValue = &lt;BR /&gt;
                     {New typedvalue(dxfCode.Start, "TEXT,MTEXT")}&lt;BR /&gt;
Dim prFilter As SelectionFilter = New SelectionFilter(Values) Dim res As PromptSelectionResult = ed.SelectAll(prFilter)&lt;BR /&gt;
&lt;BR /&gt;
Select case id.gettype.name&lt;BR /&gt;
         case Text&lt;BR /&gt;
                  ...&lt;BR /&gt;
          case Mtext&lt;BR /&gt;
                   ....&lt;BR /&gt;
End Select&lt;/GILSEORIN&gt;</description>
      <pubDate>Wed, 21 Feb 2007 10:18:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895572#M78914</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-21T10:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895573#M78915</link>
      <description>Thanks for your concern,Tony.&lt;BR /&gt;
Of course, I know how to.&lt;BR /&gt;
&lt;BR /&gt;
I attached file working in the each subroutine.&lt;BR /&gt;
I wish to merge this two subroutines to unique one.</description>
      <pubDate>Wed, 21 Feb 2007 10:41:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895573#M78915</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-21T10:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895574#M78916</link>
      <description>Sorry, Here it is.</description>
      <pubDate>Wed, 21 Feb 2007 10:42:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895574#M78916</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-21T10:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895575#M78917</link>
      <description>Cconsider spending more time on language and&lt;BR /&gt;
framework theory and concepts, and learning to &lt;BR /&gt;
use the language correctly. &lt;BR /&gt;
&lt;BR /&gt;
IOW, you're using constructs like 'Try/Finally'&lt;BR /&gt;
and 'Using', without really understanding exactly &lt;BR /&gt;
what they are or how they work. &lt;BR /&gt;
&lt;BR /&gt;
Your mixing the use of 'Using' with Try/Finally to &lt;BR /&gt;
manage transactions, and also not knowing how to &lt;BR /&gt;
deal with different types of objects, makes it clear&lt;BR /&gt;
that you're still missing some basic key concepts&lt;BR /&gt;
that you need, before you can write working code&lt;BR /&gt;
that you can be reasonably confident will not blow &lt;BR /&gt;
up when you try to use it. &lt;BR /&gt;
&lt;BR /&gt;
Here is a sample sub that shows the correct way to&lt;BR /&gt;
deal with transactions (call Commit() when you're&lt;BR /&gt;
done, or let the transaction abort if your code fails&lt;BR /&gt;
before that) and how to test the type of an object,&lt;BR /&gt;
and then cast to a more specific type. &lt;BR /&gt;
&lt;BR /&gt;
To get any type of valid candidate entity, you assign&lt;BR /&gt;
first to the more generic 'Entity' type, and then test &lt;BR /&gt;
the object's actual type using TypeOf to see if it is &lt;BR /&gt;
DBText or MTEXT. Once you know which type it is,&lt;BR /&gt;
you can then cast the object to a variable of that &lt;BR /&gt;
type (DBText or MText in this case).&lt;BR /&gt;
&lt;BR /&gt;
As far as combining the two subs you have, I'm&lt;BR /&gt;
not going to do that, but this should give you an&lt;BR /&gt;
idea of how to do it yourself.&lt;BR /&gt;
&lt;BR /&gt;
Private Sub Example()&lt;BR /&gt;
   Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor&lt;BR /&gt;
   Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database&lt;BR /&gt;
   Using trans As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;
      Dim Values() As TypedValue = {New TypedValue(DxfCode.Start, "TEXT")}&lt;BR /&gt;
      Dim prFilter As SelectionFilter = New SelectionFilter(Values)&lt;BR /&gt;
      Dim res As PromptSelectionResult = ed.SelectAll(prFilter)&lt;BR /&gt;
      If res.Status = PromptStatus.Error Then Return&lt;BR /&gt;
      Dim SS As SelectionSet = res.Value&lt;BR /&gt;
      Dim idarray As ObjectId() = SS.GetObjectIds()&lt;BR /&gt;
      For i As Integer = 0 To idarray.Length - 1&lt;BR /&gt;
          Dim id As ObjectId = res.Value.Item(i).ObjectId&lt;BR /&gt;
&lt;BR /&gt;
          ' all objects encountered here must derive from 'Entity',&lt;BR /&gt;
          ' so that is the type you cast to first:&lt;BR /&gt;
&lt;BR /&gt;
          Dim ent1 As Entity = DirectCast(trans.GetObject(id, OpenMode.ForWrite), Entity)&lt;BR /&gt;
&lt;BR /&gt;
          ' Next see if the entity's actual type is DBText or MText,&lt;BR /&gt;
          ' branch accordingly and cast to a variable of the actual &lt;BR /&gt;
          ' type, and then work with the object:&lt;BR /&gt;
&lt;BR /&gt;
          If TypeOf ent1 Is DBText Then&lt;BR /&gt;
              Dim dbtext As DBText = DirectCast(ent1, DBText)&lt;BR /&gt;
              Console.Write("This is a TEXT object")&lt;BR /&gt;
              ' code to handle TEXT here&lt;BR /&gt;
          ElseIf TypeOf ent1 Is MText Then&lt;BR /&gt;
              Dim mtext as MText = DirectCast(ent1, MText)&lt;BR /&gt;
              Console.Write("This is an MTEXT object")&lt;BR /&gt;
              ' code to handle MTEXT here&lt;BR /&gt;
          End If&lt;BR /&gt;
      Next&lt;BR /&gt;
      ' ------------------------------------------------------&lt;BR /&gt;
      ' Don't put Commit() in a 'Finally' because you don't&lt;BR /&gt;
      ' want to commit the transaction if something&lt;BR /&gt;
      ' goes wrong above, and the flow of execution&lt;BR /&gt;
      ' transfers out of the Using block prematurely.&lt;BR /&gt;
      ' ------------------------------------------------------&lt;BR /&gt;
      trans.Commit()&lt;BR /&gt;
   &lt;BR /&gt;
   ' The Using construct automatically calls Dispose()&lt;BR /&gt;
   ' on the Transaction object here, so you do not need&lt;BR /&gt;
   ' to do that manually.&lt;BR /&gt;
&lt;BR /&gt;
   End Using &lt;BR /&gt;
End Sub&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 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;GILSEORIN&gt; wrote in message news:5494053@discussion.autodesk.com...&lt;BR /&gt;
Thanks for your concern,Tony.&lt;BR /&gt;
Of course, I know how to.&lt;BR /&gt;
&lt;BR /&gt;
I attached file working in the each subroutine.&lt;BR /&gt;
I wish to merge this two subroutines to unique one.&lt;/GILSEORIN&gt;</description>
      <pubDate>Thu, 22 Feb 2007 02:28:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895575#M78917</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-22T02:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895576#M78918</link>
      <description>Thank you so much,Tony.&lt;BR /&gt;
Your advice encouraged me to program more prudently.&lt;BR /&gt;
I appreciate your kind one deeply.&lt;BR /&gt;
&lt;BR /&gt;
For another person, I attached final code.</description>
      <pubDate>Thu, 22 Feb 2007 06:38:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895576#M78918</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-22T06:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895577#M78919</link>
      <description>My mistake! &lt;BR /&gt;
In my attached file, I should insert 'Using ~ End Using'.&lt;BR /&gt;
Of course, 'trans.dispose()'  is not.</description>
      <pubDate>Thu, 22 Feb 2007 07:03:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895577#M78919</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-22T07:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895578#M78920</link>
      <description>Ugh, here is my first baby steps in VB.NET...&lt;BR /&gt;
I was trying to use your code but&lt;BR /&gt;
without of luck&lt;BR /&gt;
I have Visual Studio .NET 2003 and A2005&lt;BR /&gt;
on my machine&lt;BR /&gt;
I created project with form and added your&lt;BR /&gt;
code into form class&lt;BR /&gt;
This is waht I have a got so far&lt;BR /&gt;
See attached picture&lt;BR /&gt;
What I did wrong?&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
&lt;BR /&gt;
Fatty&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Thu, 22 Feb 2007 20:34:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895578#M78920</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-22T20:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895579#M78921</link>
      <description>Ooops, you should basically know the grammar and structure&lt;BR /&gt;
of the .net.&lt;BR /&gt;
In this way, there's  only  endless question.&lt;BR /&gt;
&lt;BR /&gt;
Inherits System.Windows.Forms.Form       //Ok&lt;BR /&gt;
&lt;BR /&gt;
imports Autodesk.AutoCad.interop                   // Ooops&lt;BR /&gt;
imports Autodesk.AutoCad.interop.common    //Oh,no.&lt;BR /&gt;
&lt;BR /&gt;
imports Autodesk.AutoCad.EditorInput             //You missed it.&lt;BR /&gt;
&lt;BR /&gt;
You should learn more from '.net trainning lab' provided &lt;BR /&gt;
by Autodesk.&lt;BR /&gt;
And then ask what.</description>
      <pubDate>Thu, 22 Feb 2007 21:18:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895579#M78921</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-22T21:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895580#M78922</link>
      <description>I agree, I no so smart as you are,&lt;BR /&gt;
but where is my EditorInput&lt;BR /&gt;
As I said before I have VS .NET 2003&lt;BR /&gt;
&lt;BR /&gt;
See picture please</description>
      <pubDate>Thu, 22 Feb 2007 22:09:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895580#M78922</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-22T22:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895581#M78923</link>
      <description>Maybe, you have AutoCad 2005.&lt;BR /&gt;
I don't like 2005  'cause it has many limitation of realize what&lt;BR /&gt;
I wish to.&lt;BR /&gt;
&lt;BR /&gt;
Perhaps,it is difficult to get any advice from other person.&lt;BR /&gt;
If you should use only Acad 2005, I suggest you get Objectarx SDK and install, then you can see there samples directory.&lt;BR /&gt;
In the subdirectory, you can also see dotnet directory.&lt;BR /&gt;
&lt;BR /&gt;
At this time, that's the only method to learn to make code working in Acad 2005.</description>
      <pubDate>Fri, 23 Feb 2007 02:18:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895581#M78923</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-23T02:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Mtext problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895582#M78924</link>
      <description>Thank you thank you thank you&lt;BR /&gt;
You gave me a good idea&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Fri, 23 Feb 2007 08:31:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-problem/m-p/1895582#M78924</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-02-23T08:31:53Z</dc:date>
    </item>
  </channel>
</rss>

