Question Setting a stream as the AlternateView content

bifteki

New member
Joined
Jul 24, 2009
Messages
4
Programming Experience
Beginner
Is there a way to provide AlternateView class with a stream as its content, other than its constructor?
There is a ContentStream property but it's read only.
I am declaring the alternateview variable in the beginning of the code but I want to initialize it with a stream some time later within the code.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,295
Location
Sydney, Australia
Programming Experience
10+
Just because you declare a variable doesn't mean you have to create an object. This code:
VB.NET:
Dim myObject As New SomeType
declares the variable and creates the object in one line. It is equivalent to this:
VB.NET:
Dim myObject As SomeType = New SomeType
If you don't want to create the object when you declare the variable then don't:
VB.NET:
Dim myObject As SomeType

'...

myObject = New SomeType
The declaration and the instantiation can be separated by as much code as you like.
 
Top Bottom