1 Replies - 261 Views - Last Post: 14 June 2012 - 11:38 AM Rate Topic: -----

#1 Prasenjit087  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 14-June 12

Specific cast is not valid in Client Server Socket program

Posted 14 June 2012 - 03:05 AM

I am Working on Teghax Component.Using This Component we want to find out Block title attribute of dwg file in a client server socket application.
1> We get Block title attributes properly of dwg file in windows application form using the getattribute function().
2> We get Block title Attributes properly in that way:-We take a class library where we take a class.in this class we use getattribute function().Then We access the particular class from another project

But when we use the same class(Keep same structure) in client server socket program.Then it gives an exception.i.e ,"Spaicfied cast is not valid"I am Not getting any reply form teghax developer..I attached exception screen sort.Give me Suggestion How to solve this Exception

Code given Bellow :
 Public Function Get_DwgFileAttribute(ByVal Sender As ClsTcpConnection, ByVal msgTag As Byte, ByVal message As String) As String
        Dictionary = GetHashtable(message)
        Dim varfilepath As String = CStr(Dictionary.Item("filePath"))
        Dim varFileBlockName As String = CStr(Dictionary.Item("fileBlockName"))
        Dim hashList As New Hashtable
        If varfilepath.ToUpper.EndsWith(".DWG") Then
            odaHost = New TeighaX.OdaHostApp
            acadApp = odaHost.Application
            acadDoc = acadApp.Documents.Open(varfilepath)
            'Dim clsObj = New Update_Attribute.Class1()
            ' Dim test As String
            '  test = clsObj.GetAttributes(varFileBlockName, varfilepath)

            For i = 0 To acadDoc.Database.Blocks.Count - 1
                If TypeOf acadDoc.Database.Blocks.Item(i) Is TeighaX.IAcadBlock Then
                    curBlock = acadDoc.Database.Blocks.Item(i)
                    If curBlock.IsLayout Then
                        If curBlock.Layout.Name = "Model" Then
                            For A = 0 To acadDoc.Database.Blocks.Item(i).Count - 1
                                If TypeOf acadDoc.Database.Blocks.Item(i).Item(A) Is TeighaX.IAcadBlockReference Then
                                    If acadDoc.Database.Blocks.Item(i).Item(A).name = varFileBlockName Then
                                        blockRef = CType(acadDoc.Database.Blocks.Item(i).Item(A), IAcadBlockReference)
                                        If blockRef.HasAttributes Then
                                           Try
                                                 For Each Attrib In blockRef.GetAttributes                   
                                                                                                                 hashList.Add(CStr(Attrib.TagString), CStr(Attrib.TextString))
                                                Next
                                            Catch ex As Exception
                                           End Try
                                        End If
                                    End If
                                End If
                            Next
                        End If
                    End If
                End If
            Next
        End If
        Return "Request Dwg Block Attribute ..."
    End Function


Suggest me how to solve this Exception...........

This post has been edited by BobRodes: 14 June 2012 - 11:36 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Specific cast is not valid in Client Server Socket program

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,979
  • Joined: 19-May 09

Re: Specific cast is not valid in Client Server Socket program

Posted 14 June 2012 - 11:38 AM

Please don't make duplicate posts in future. It only confuses everyone and makes it harder to help you. I answered this on your other post, so I'm shutting this down.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1