ty9413
2016-05-02 06:59
采纳率: 25%
浏览 3.7k
已采纳

VB.NET提示未将对象引用设置到对象的实例

我做毕业设计,用VB.NET设计界面,打开pre/e的模型,但是一直错误,求指点
图片说明
Imports pfcls
Imports System.Reflection.Assembly
Public Class 建模
Public asyncConnection As IpfcAsyncConnection
Public cac As CCpfcAsyncConnection
Dim model As IpfcModel
Public parameterOwner As IpfcParameterOwner
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cac As CCpfcAsyncConnection
cac = New CCpfcAsyncConnection
asyncConnection = cac.Start("D:\Program Files\proeWildfire 4.0\bin\proe1.bat", ".")
Dim proeid As IpfcAsyncConnection
proeid = (New CCpfcAsyncConnection).Connect(Nothing, Nothing, Nothing, Nothing)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim descModel As IpfcModelDescriptor
    Dim options As IpfcRetrieveModelOptions
    Dim session As IpfcBaseSession
    Dim currentws As Object

    session = asyncConnection.Session
    options = (New CCpfcRetrieveModelOptions).Create
    options.AskUserAboutReps = False
    session.ChangeDirectory("D:\ZY")
    descModel = (New CCpfcModelDescriptor).Create(EpfcModelType.EpfcMDL_PART, Nothing, Nothing)
    descModel.Path = "D:\ZY\asm0001.asmt"
    model = asyncConnection.Session.RetrieveModelWithOpts(descModel, options)
    session.CreateModelWindow(model)
    currentws = session.GetCurrentWS()
    model.Display()
End Sub
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • blownewbee 2016-05-02 15:43
    已采纳

    asyncConnection在哪里赋值的,它是nothing啊。

    点赞 评论

相关推荐 更多相似问题