1

I converted an ArcMap VBA code to a Visual Studio dll. In doing so I had to reference a new namespace "stdole" so my graphic label would show in ArcMap. The label works on my computer, but does not work on other computers that do not have VS 2010. I'm guessing it is because the namespace stdole.dll is not on the other computers? Are there any alternative namespaces that I can reference that the older computers might have? Below is the VBA pre and raw VB.NET post code conversion (<<<< this defines the code statement where the stdole namespace was needed).

VBA version

'Get the point location

Set pPoint = pFeature.Shape
pTextElement.Text = strLabel 'Add the text string to the Text Symbol

Dim myFont As IFontDisp
Set myFont = New StdFont
myFont.Name = "Courier New"
myFont.Size = 1

pTextElement.Symbol.Size = 5#   'Added Text Symbol Size
pTextElement.Symbol.Font = myFont
pElement.Geometry = pPoint
pGraphicsContainer.AddElement pTextElement, 0

VB.NET version

'Get the point location

pPoint = pFeature.Shape
pTextElement.Text = strLabel 'Add the text string to the Text Symbol

Dim VB6 As Object VB6 = Nothing

Dim myFont As System.Drawing.Font

myFont = System.Windows.Forms.Control.DefaultFont.Clone()
myFont = VB6.FontChangeName(myFont, "Courier New")
myFont = VB6.FontChangeSize(myFont, 1)

pTextElement.Symbol.Size = 5# 
pTextElement.Symbol.Font = VB6.FontChangeName(pTextElement.Symbol.Font, myFont.Name) '<<<< stdole namespace needed
pElement.Geometry = pPoint

pGraphicsContainer.AddElement(pTextElement, 0)

1

If it works on PCs with programming software and not on PCs that don't have it, then you are missing a redistributable runtime program on the other computers.

Here is the one for VB6 and there is one for VB.NET, C#, C++ etc. Usually your installation program should take care of providing the redistrubutable, but either it didn't or you are not using an installation program to put your program on the client PCs.

Good Luck

  • do you know where the VB.NET one is located? – artwork21 Apr 7 '11 at 16:04
0

Here is the solution to my original question.

I replaced:

Dim myFont As IFontDisp
Set myFont = New StdFont
myFont.Name = "Courier New"
myFont.Size = 1

with this:

Dim myFont As stdole.IFontDisp = New stdole.StdFontClass()
myFont.Name = "Courier New"
myFont.Size = 1

It appears that I had to make a new instance of the stdole class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.