__WriteLine can't write a Color variable??

T

TryingLikeHeck

The statement:
WriteLine(lFileNum, mFirstLineColor)

Fails with the following error:
Additional information: Procedure call or argument is not valid.

mFirstLineColor is type Color

Can't Write write a Color??

If you just want to save a bunch of stuff and restore it later is Write the
way to go or is Print a better way. Or is there something else that's better?

Thanks in advance


(e-mail address removed)
 
C

Cor

Hi

What kind of code is this,
WriteLine(lFileNum, mFirstLineColor)

Because there are a lot of WriteLine methods, so I don't think it will work
by only writing writeline(x,x)

But in this case it is very much possible I am wrong.

Cor
 
A

Armin Zingler

TryingLikeHeck said:
The statement:
WriteLine(lFileNum, mFirstLineColor)

Fails with the following error:
Additional information: Procedure call or argument is not valid.

mFirstLineColor is type Color

Can't Write write a Color??

I found several WriteLine methods. Which one are you referring to?

System.Console.WriteLine
System.IO.TextWriter.WriteLine
System.CodeDom.Compiler.IndentedTextWriter.WriteLine
Microsoft.VisualBasic.FileSystem.WriteLine
System.Diagnostics.TraceListener.WriteLine
System.Diagnostics.Trace.WriteLine
System.Diagnostics.Debug.WriteLine
System.Diagnostics.DefaultTraceListener.WriteLine
System.Diagnostics.TextWriterTraceListener.WriteLine
If you just want to save a bunch of stuff and restore it later is
Write the way to go or is Print a better way. Or is there something
else that's better?

Don't know if it's the better way but it's one way:
http://msdn.microsoft.com/library/en-us/cpguide/html/cpovrserializingobjects.asp
 
T

TryingLikeHeck

I don't know but check the Help

Public Sub WriteLine( _
ByVal FileNumber As Integer, _
ByVal ParamArray Output() As Object _
)
Parameters


Any suggestions on how to write Color??

Thanks
(e-mail address removed)
 
T

TryingLikeHeck

Public Sub WriteLine( _
ByVal FileNumber As Integer, _
ByVal ParamArray Output() As Object _
)
Parameters

Microsoft.VisualBasic


Any suggestions on how to write Color?
I tried CTYPE(zzz,Integer) - can't convert

Thanks

(e-mail address removed)
 
A

Armin Zingler

TryingLikeHeck said:
Public Sub WriteLine( _
ByVal FileNumber As Integer, _
ByVal ParamArray Output() As Object _
)
Parameters

Microsoft.VisualBasic


Any suggestions on how to write Color?
I tried CTYPE(zzz,Integer) - can't convert

A color is not an Integer. Which property or function value of the Color do
you want to write? Maybe you are looking for the ToArgb method?

WriteLine(1, Color.Red.ToArgb)
 
A

active

I'll look at the link you sent.

The problem is that I can write variables to a file that are type Integer or
Boolean, but not a variable that is type Color.

Since Color is actually the same size as an Integer I would hope that I
could out smart it and get it to write the equivalent value by somehow
casting Color as an Integer.

But I guess I'm not that smart..

Thanks
 
C

Cor

Hi active,

Now I understand it,

Color is not a field that you can write to disk.

I never used it, but it seems that you can do
\\\
Dim MyRGB As Integer = Color.AliceBlue.ToArgb
Dim myColor As Color = Color.FromArgb(MyRGB)
///
So that MyRGB is what you can write to disk.

I hope this was it?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top