J
John
Hi,
I'm still having trouble with referencing a ListView control (in Form1) from
a second form (fmOps). I'm getting an "Object reference not set to an
instance of an object" error, which I think is occuring at the "For Each itm
In Me.openingForm.lstWrkFiles.Items" line. Can anyone tell me what I'm
doing wrong?
(Note - I know an error will occur if Visio is not open, so for the moment,
it is.)
Thanks
John
In "Form1"
Public Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click
Dim secondForm As fmOps
secondForm = New fmOps
secondForm.Show()
End Sub
In second form ("fmOps")
Inside class...
Friend openingForm As Form1
Further down...
Public Sub btProcess_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btProcess.Click
'Dim openingForm As New Form1
Try
Dim vDoc As Document 'Visio Document
Dim vWin As Window 'Visio Window
m_appVisio = GetObject(, "visio.application")
Dim itm As ListViewItem
For Each itm In Me.openingForm.lstWrkFiles.Items
vDoc = m_appVisio.Documents.Open(itm.Text)
'Whole Page View
If ckBxWholePageView.Checked = True Then
AllPageWholeView(vDoc)
End If
System.Windows.Forms.MessageBox.Show("Done", MessageBoxButtons.OK)
vDoc.Close()
Next
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
I'm still having trouble with referencing a ListView control (in Form1) from
a second form (fmOps). I'm getting an "Object reference not set to an
instance of an object" error, which I think is occuring at the "For Each itm
In Me.openingForm.lstWrkFiles.Items" line. Can anyone tell me what I'm
doing wrong?
(Note - I know an error will occur if Visio is not open, so for the moment,
it is.)
Thanks
John
In "Form1"
Public Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click
Dim secondForm As fmOps
secondForm = New fmOps
secondForm.Show()
End Sub
In second form ("fmOps")
Inside class...
Friend openingForm As Form1
Further down...
Public Sub btProcess_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btProcess.Click
'Dim openingForm As New Form1
Try
Dim vDoc As Document 'Visio Document
Dim vWin As Window 'Visio Window
m_appVisio = GetObject(, "visio.application")
Dim itm As ListViewItem
For Each itm In Me.openingForm.lstWrkFiles.Items
vDoc = m_appVisio.Documents.Open(itm.Text)
'Whole Page View
If ckBxWholePageView.Checked = True Then
AllPageWholeView(vDoc)
End If
System.Windows.Forms.MessageBox.Show("Done", MessageBoxButtons.OK)
vDoc.Close()
Next
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub