2 ty9413 ty9413 于 2016.05.02 14:59 提问

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

2个回答

caozhy
caozhy   Ds   Rxr 2016.05.02 23:43
已采纳

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

ty9413
ty9413 谢谢你,我已经解决了
一年多之前 回复
CSDNXIAOD
CSDNXIAOD   2016.05.02 15:01

wpf 提示未将对象引用设置到对象的实例
为数组赋值时提示”未将对象引用设置到对象的实例“
未将对象引用设置到对象的实例
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!