__WriteLine can't write a Color variable??

  • Thread starter Thread starter TryingLikeHeck
  • Start date Start date
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)
 
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
 
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
 
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)
 
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)
 
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)
 
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
 
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
 
Back
Top