473,624 Members | 2,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default Value of Nothing for Property of type System.Drawing. Image

Hi Everyone,

I'm writing a UserControl that exposes a property of the type
System.Drawing. Image, like this:

Public Property DefaultImage() As Image
Get
Return propDefaultImag e
End Get
Set(ByVal Value As Image)
propDefaultImag e = Value
SetImage()
End Set
End Property

The property behaves *mostly* as expected. What I'm having trouble with is
the behavior of the property at design-time. I would like to accomplish two
things:

1) When my control is placed on a form, in the property browser, my
DefaultImage property value is shown to be "(none)". This is correct,
except it is appearing in a bold font as if the value has been changed from
the default value. When the value is "(none)" I would like it to not be
bold.

2) When the developer defines the image by clicking the "..." browse button
and selecting a bitmap, all is well: the image is set and everything does
what was intended. However, in the property browser, if the developer
selects the property value and presses the [del] button on the keyboard, the
image is not removed. I would like this to occur.

If you look at the BackgroundImage property of a Form, you can see the
behavior I am trying to emulate. I *thought* the solution would just be to
define the DefaultValue() attribute for the property to be Nothing, like
this:

<DefaultValue(N othing)_
Public Property DefaultImage() As Image
....

DefaultValue() is overloaded 11 times and one of the possible arguments is
Object, so I figured Nothing would fit for that one. But it does not:
"Overload resolution failed...". I then tried all sorts of things like
this:

Dim NothingImage As System.Drawing. Image = Nothing

<DefaultValue(N othingImage)_
Public Property DefaultImage() As Image
....

but I can't do that because DefaultValue() requires a constant. I can't
have a constant be an object, so... I'm stuck. There's got to be something
obvious that I'm missing. Any ideas?
Thank you for your help!!

Eric
Jan 6 '07 #1
9 5041
Using Lutz Roeder's .NET Reflector, I found that the BackgroundImage property
of a Form (it actually inherits this from the Control class) looks something
like this:

<DefaultValue(C Str(Nothing))_
Public Overridable Property BackgroundImage As Image
Get
Return propBackgroundI mage
End Get
Set(ByVal value As Image)
If (Not Me.BackgroundIm age Is value) Then
propBackgroundI mage = value
Me.Invalidate
End If
End Set
End Property

Tony

"Eric" wrote:
Hi Everyone,

I'm writing a UserControl that exposes a property of the type
System.Drawing. Image, like this:

Public Property DefaultImage() As Image
Get
Return propDefaultImag e
End Get
Set(ByVal Value As Image)
propDefaultImag e = Value
SetImage()
End Set
End Property

The property behaves *mostly* as expected. What I'm having trouble with is
the behavior of the property at design-time. I would like to accomplish two
things:

1) When my control is placed on a form, in the property browser, my
DefaultImage property value is shown to be "(none)". This is correct,
except it is appearing in a bold font as if the value has been changed from
the default value. When the value is "(none)" I would like it to not be
bold.

2) When the developer defines the image by clicking the "..." browse button
and selecting a bitmap, all is well: the image is set and everything does
what was intended. However, in the property browser, if the developer
selects the property value and presses the [del] button on the keyboard, the
image is not removed. I would like this to occur.

If you look at the BackgroundImage property of a Form, you can see the
behavior I am trying to emulate. I *thought* the solution would just be to
define the DefaultValue() attribute for the property to be Nothing, like
this:

<DefaultValue(N othing)_
Public Property DefaultImage() As Image
....

DefaultValue() is overloaded 11 times and one of the possible arguments is
Object, so I figured Nothing would fit for that one. But it does not:
"Overload resolution failed...". I then tried all sorts of things like
this:

Dim NothingImage As System.Drawing. Image = Nothing

<DefaultValue(N othingImage)_
Public Property DefaultImage() As Image
....

but I can't do that because DefaultValue() requires a constant. I can't
have a constant be an object, so... I'm stuck. There's got to be something
obvious that I'm missing. Any ideas?
Thank you for your help!!

Eric
Jan 6 '07 #2
just... wow. I never would have guessed that. But, I popped it in there
and it worked (both of my needs were solved). Thank you *very* much!
--

Eric
"tlkerns" <tl*****@discus sions.microsoft .comwrote in message
news:8F******** *************** ***********@mic rosoft.com...
Using Lutz Roeder's .NET Reflector, I found that the BackgroundImage
property
of a Form (it actually inherits this from the Control class) looks
something
like this:

<DefaultValue(C Str(Nothing))_
Public Overridable Property BackgroundImage As Image
Get
Return propBackgroundI mage
End Get
Set(ByVal value As Image)
If (Not Me.BackgroundIm age Is value) Then
propBackgroundI mage = value
Me.Invalidate
End If
End Set
End Property

Tony

"Eric" wrote:
>Hi Everyone,

I'm writing a UserControl that exposes a property of the type
System.Drawing .Image, like this:

Public Property DefaultImage() As Image
Get
Return propDefaultImag e
End Get
Set(ByVal Value As Image)
propDefaultImag e = Value
SetImage()
End Set
End Property

The property behaves *mostly* as expected. What I'm having trouble with
is
the behavior of the property at design-time. I would like to accomplish
two
things:

1) When my control is placed on a form, in the property browser, my
DefaultImage property value is shown to be "(none)". This is correct,
except it is appearing in a bold font as if the value has been changed
from
the default value. When the value is "(none)" I would like it to not be
bold.

2) When the developer defines the image by clicking the "..." browse
button
and selecting a bitmap, all is well: the image is set and everything does
what was intended. However, in the property browser, if the developer
selects the property value and presses the [del] button on the keyboard,
the
image is not removed. I would like this to occur.

If you look at the BackgroundImage property of a Form, you can see the
behavior I am trying to emulate. I *thought* the solution would just be
to
define the DefaultValue() attribute for the property to be Nothing, like
this:

<DefaultValue( Nothing)_
Public Property DefaultImage() As Image
....

DefaultValue () is overloaded 11 times and one of the possible arguments
is
Object, so I figured Nothing would fit for that one. But it does not:
"Overload resolution failed...". I then tried all sorts of things like
this:

Dim NothingImage As System.Drawing. Image = Nothing

<DefaultValue( NothingImage)_
Public Property DefaultImage() As Image
....

but I can't do that because DefaultValue() requires a constant. I can't
have a constant be an object, so... I'm stuck. There's got to be
something
obvious that I'm missing. Any ideas?
Thank you for your help!!

Eric
Jan 6 '07 #3
Eric,
I normally use:

<DefaultValue(D irectCast(Nothi ng, Image))_
Public Property DefaultImage() As Image
...

As the value of the default is really an Image & not a String.

Granted a String Nothing has exactly the same value as an Image Nothing, the
cast is simply needed so the compiler & pick the correct overload, in this
case the object overload.
The problem with Reflector, is that it has to *guess* at what type Nothing
is, and it simply picks the first type that comes to mind...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Eric" <er**@ejproduct ions.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
just... wow. I never would have guessed that. But, I popped it in there
and it worked (both of my needs were solved). Thank you *very* much!
--

Eric
"tlkerns" <tl*****@discus sions.microsoft .comwrote in message
news:8F******** *************** ***********@mic rosoft.com...
>Using Lutz Roeder's .NET Reflector, I found that the BackgroundImage
property
of a Form (it actually inherits this from the Control class) looks
something
like this:

<DefaultValue( CStr(Nothing))_
Public Overridable Property BackgroundImage As Image
Get
Return propBackgroundI mage
End Get
Set(ByVal value As Image)
If (Not Me.BackgroundIm age Is value) Then
propBackgroundI mage = value
Me.Invalidate
End If
End Set
End Property

Tony

"Eric" wrote:
>>Hi Everyone,

I'm writing a UserControl that exposes a property of the type
System.Drawin g.Image, like this:

Public Property DefaultImage() As Image
Get
Return propDefaultImag e
End Get
Set(ByVal Value As Image)
propDefaultImag e = Value
SetImage()
End Set
End Property

The property behaves *mostly* as expected. What I'm having trouble with
is
the behavior of the property at design-time. I would like to accomplish
two
things:

1) When my control is placed on a form, in the property browser, my
DefaultImag e property value is shown to be "(none)". This is correct,
except it is appearing in a bold font as if the value has been changed
from
the default value. When the value is "(none)" I would like it to not be
bold.

2) When the developer defines the image by clicking the "..." browse
button
and selecting a bitmap, all is well: the image is set and everything
does
what was intended. However, in the property browser, if the developer
selects the property value and presses the [del] button on the keyboard,
the
image is not removed. I would like this to occur.

If you look at the BackgroundImage property of a Form, you can see the
behavior I am trying to emulate. I *thought* the solution would just be
to
define the DefaultValue() attribute for the property to be Nothing, like
this:

<DefaultValue (Nothing)_
Public Property DefaultImage() As Image
....

DefaultValue( ) is overloaded 11 times and one of the possible arguments
is
Object, so I figured Nothing would fit for that one. But it does not:
"Overload resolution failed...". I then tried all sorts of things like
this:

Dim NothingImage As System.Drawing. Image = Nothing

<DefaultValue (NothingImage)_
Public Property DefaultImage() As Image
....

but I can't do that because DefaultValue() requires a constant. I can't
have a constant be an object, so... I'm stuck. There's got to be
something
obvious that I'm missing. Any ideas?
Thank you for your help!!

Eric
Jan 7 '07 #4

Hi Eric, on 6 dec you asked this question on interoperabilit y btwn COM
& .NET when files are in same directory.

Did you get it working without resorting to using regasm /CODEBASE ?

i am asking because i am similarly stuck. thanks

Hello,

I have a .NET dll, it's in the c:\myfiles\bin directory. I went into a

Visual Studio 2005 Command Prompt changed directory to the
c:\myfiles\bin directory and ran a regasm /tlb MyDotNet.dll, so I
inside my c:\myfiles\bin directory I have MyDotNet.dll and
MyDotNet.tlb.
I then start up a VBScript test harness like so:
Dim objMyDotNet
Dim mystr
On Error Resume Next
msgbox "Getting ready to create the object."
Set objMyDotNet = CreateObject("M yDotNet.clsMyCl ass")
If Err.Number 0 Then
MsgBox "Error # " & Err.Number & " occurred, description: " &
Err.Description & " Hex: " & Hex(Err.Number) & " Source: " &
Err.Source
Err.Clear
End If
However, I get the message:
Error #424 occurred, description: Object required Hex: 1A7 Source:
Microsoft VBScript runtime error.
If I then run
regasm /codebase MyDotNet.dll
the error goes away.
>From what I read in Adam Nathan's ".NET and COM The Complete

Interoperabilit y Guide:"

/codebase registers the location of the assembly file under every CLSID

with a CodeBase value. With this value registered, the CLR can locate
assemblies anywhere in the file system ... This is a fallback
mechanism, so if the registered assembly is found in the GAC or in the
local directory, the CodeBase value is not used (my .NET dll is
strongly named in case you're wondering).
Well my .tlb and .dll are in the same directory, so why do I need the
/codebase option? Does he mean that the calling COM application would
have to be in the same directory as the .dll? If this is true, could
the .tlb file be located elsewhere in the file system?
Thanks,
Eric

Jan 7 '07 #5
ah- understood. Thank you!

--
Eric


"Jay B. Harlow [MVP - Outlook]" <Ja************ @tsbradley.netw rote in
message news:Ov******** *****@TK2MSFTNG P04.phx.gbl...
Eric,
I normally use:

<DefaultValue(D irectCast(Nothi ng, Image))_
Public Property DefaultImage() As Image
...

As the value of the default is really an Image & not a String.

Granted a String Nothing has exactly the same value as an Image Nothing,
the cast is simply needed so the compiler & pick the correct overload, in
this case the object overload.
The problem with Reflector, is that it has to *guess* at what type Nothing
is, and it simply picks the first type that comes to mind...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Eric" <er**@ejproduct ions.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>just... wow. I never would have guessed that. But, I popped it in there
and it worked (both of my needs were solved). Thank you *very* much!
--

Eric
"tlkerns" <tl*****@discus sions.microsoft .comwrote in message
news:8F******* *************** ************@mi crosoft.com...
>>Using Lutz Roeder's .NET Reflector, I found that the BackgroundImage
property
of a Form (it actually inherits this from the Control class) looks
something
like this:

<DefaultValue (CStr(Nothing)) _
Public Overridable Property BackgroundImage As Image
Get
Return propBackgroundI mage
End Get
Set(ByVal value As Image)
If (Not Me.BackgroundIm age Is value) Then
propBackgroundI mage = value
Me.Invalidate
End If
End Set
End Property

Tony

"Eric" wrote:

Hi Everyone,

I'm writing a UserControl that exposes a property of the type
System.Drawi ng.Image, like this:

Public Property DefaultImage() As Image
Get
Return propDefaultImag e
End Get
Set(ByVal Value As Image)
propDefaultImag e = Value
SetImage()
End Set
End Property

The property behaves *mostly* as expected. What I'm having trouble
with is
the behavior of the property at design-time. I would like to
accomplish two
things:

1) When my control is placed on a form, in the property browser, my
DefaultIma ge property value is shown to be "(none)". This is correct,
except it is appearing in a bold font as if the value has been changed
from
the default value. When the value is "(none)" I would like it to not
be
bold.

2) When the developer defines the image by clicking the "..." browse
button
and selecting a bitmap, all is well: the image is set and everything
does
what was intended. However, in the property browser, if the developer
selects the property value and presses the [del] button on the
keyboard, the
image is not removed. I would like this to occur.

If you look at the BackgroundImage property of a Form, you can see the
behavior I am trying to emulate. I *thought* the solution would just
be to
define the DefaultValue() attribute for the property to be Nothing,
like
this:

<DefaultValu e(Nothing)_
Public Property DefaultImage() As Image
....

DefaultValue () is overloaded 11 times and one of the possible arguments
is
Object, so I figured Nothing would fit for that one. But it does not:
"Overload resolution failed...". I then tried all sorts of things like
this:

Dim NothingImage As System.Drawing. Image = Nothing

<DefaultValu e(NothingImage) _
Public Property DefaultImage() As Image
....

but I can't do that because DefaultValue() requires a constant. I
can't
have a constant be an object, so... I'm stuck. There's got to be
something
obvious that I'm missing. Any ideas?
Thank you for your help!!

Eric
Jan 8 '07 #6
Hi xamman,

I'm sorry, but that Eric wasn't me. I've used COM DLLs in .NET before, but
never when they are in the same directory. I'll have a look and see if I
can help, but I suggest you post again at the top of this thread so that
someone smarter than me can have a look. ;)
--

Eric
"xamman" <xa******@yahoo .comwrote in message
news:11******** **************@ s80g2000cwa.goo glegroups.com.. .
>
Hi Eric, on 6 dec you asked this question on interoperabilit y btwn COM
& .NET when files are in same directory.

Did you get it working without resorting to using regasm /CODEBASE ?

i am asking because i am similarly stuck. thanks

Hello,

I have a .NET dll, it's in the c:\myfiles\bin directory. I went into a

Visual Studio 2005 Command Prompt changed directory to the
c:\myfiles\bin directory and ran a regasm /tlb MyDotNet.dll, so I
inside my c:\myfiles\bin directory I have MyDotNet.dll and
MyDotNet.tlb.
I then start up a VBScript test harness like so:
Dim objMyDotNet
Dim mystr
On Error Resume Next
msgbox "Getting ready to create the object."
Set objMyDotNet = CreateObject("M yDotNet.clsMyCl ass")
If Err.Number 0 Then
MsgBox "Error # " & Err.Number & " occurred, description: " &
Err.Description & " Hex: " & Hex(Err.Number) & " Source: " &
Err.Source
Err.Clear
End If
However, I get the message:
Error #424 occurred, description: Object required Hex: 1A7 Source:
Microsoft VBScript runtime error.
If I then run
regasm /codebase MyDotNet.dll
the error goes away.
>>From what I read in Adam Nathan's ".NET and COM The Complete


Interoperabilit y Guide:"

/codebase registers the location of the assembly file under every CLSID

with a CodeBase value. With this value registered, the CLR can locate
assemblies anywhere in the file system ... This is a fallback
mechanism, so if the registered assembly is found in the GAC or in the
local directory, the CodeBase value is not used (my .NET dll is
strongly named in case you're wondering).
Well my .tlb and .dll are in the same directory, so why do I need the
/codebase option? Does he mean that the calling COM application would
have to be in the same directory as the .dll? If this is true, could
the .tlb file be located elsewhere in the file system?
Thanks,
Eric
Jan 8 '07 #7
doh- same sort of error with:

DefaultValue(Di rectCast(Nothin g, Image))

Error: "Conversion from 'System.Drawing .Image' to 'System.Object' cannot
occur within a constant expression."

Looks like I'll be sticking with CStr(Nothing).
Thanks again for your help, everyone!

Eric
"Jay B. Harlow [MVP - Outlook]" <Ja************ @tsbradley.netw rote in
message news:Ov******** *****@TK2MSFTNG P04.phx.gbl...
Eric,
I normally use:

<DefaultValue(D irectCast(Nothi ng, Image))_
Public Property DefaultImage() As Image
...

As the value of the default is really an Image & not a String.

Granted a String Nothing has exactly the same value as an Image Nothing,
the cast is simply needed so the compiler & pick the correct overload, in
this case the object overload.
The problem with Reflector, is that it has to *guess* at what type Nothing
is, and it simply picks the first type that comes to mind...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Eric" <er**@ejproduct ions.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>just... wow. I never would have guessed that. But, I popped it in there
and it worked (both of my needs were solved). Thank you *very* much!
--

Eric
"tlkerns" <tl*****@discus sions.microsoft .comwrote in message
news:8F******* *************** ************@mi crosoft.com...
>>Using Lutz Roeder's .NET Reflector, I found that the BackgroundImage
property
of a Form (it actually inherits this from the Control class) looks
something
like this:

<DefaultValue (CStr(Nothing)) _
Public Overridable Property BackgroundImage As Image
Get
Return propBackgroundI mage
End Get
Set(ByVal value As Image)
If (Not Me.BackgroundIm age Is value) Then
propBackgroundI mage = value
Me.Invalidate
End If
End Set
End Property

Tony

"Eric" wrote:

Hi Everyone,

I'm writing a UserControl that exposes a property of the type
System.Drawi ng.Image, like this:

Public Property DefaultImage() As Image
Get
Return propDefaultImag e
End Get
Set(ByVal Value As Image)
propDefaultImag e = Value
SetImage()
End Set
End Property

The property behaves *mostly* as expected. What I'm having trouble
with is
the behavior of the property at design-time. I would like to
accomplish two
things:

1) When my control is placed on a form, in the property browser, my
DefaultIma ge property value is shown to be "(none)". This is correct,
except it is appearing in a bold font as if the value has been changed
from
the default value. When the value is "(none)" I would like it to not
be
bold.

2) When the developer defines the image by clicking the "..." browse
button
and selecting a bitmap, all is well: the image is set and everything
does
what was intended. However, in the property browser, if the developer
selects the property value and presses the [del] button on the
keyboard, the
image is not removed. I would like this to occur.

If you look at the BackgroundImage property of a Form, you can see the
behavior I am trying to emulate. I *thought* the solution would just
be to
define the DefaultValue() attribute for the property to be Nothing,
like
this:

<DefaultValu e(Nothing)_
Public Property DefaultImage() As Image
....

DefaultValue () is overloaded 11 times and one of the possible arguments
is
Object, so I figured Nothing would fit for that one. But it does not:
"Overload resolution failed...". I then tried all sorts of things like
this:

Dim NothingImage As System.Drawing. Image = Nothing

<DefaultValu e(NothingImage) _
Public Property DefaultImage() As Image
....

but I can't do that because DefaultValue() requires a constant. I
can't
have a constant be an object, so... I'm stuck. There's got to be
something
obvious that I'm missing. Any ideas?
Thank you for your help!!

Eric
Jan 8 '07 #8
VS 2003 (.NET 1.x) or VS 2005 (.NET 2.0)?

The sample I gave compiles in VS 2005; .NET 2.0 has changed what is allowed
to be passed as a parameter to an attribute.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Eric" <er**@ejproduct ions.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
doh- same sort of error with:

DefaultValue(Di rectCast(Nothin g, Image))

Error: "Conversion from 'System.Drawing .Image' to 'System.Object' cannot
occur within a constant expression."

Looks like I'll be sticking with CStr(Nothing).
Thanks again for your help, everyone!

Eric
"Jay B. Harlow [MVP - Outlook]" <Ja************ @tsbradley.netw rote in
message news:Ov******** *****@TK2MSFTNG P04.phx.gbl...
>Eric,
I normally use:

<DefaultValue(D irectCast(Nothi ng, Image))_
Public Property DefaultImage() As Image
...

As the value of the default is really an Image & not a String.

Granted a String Nothing has exactly the same value as an Image Nothing,
the cast is simply needed so the compiler & pick the correct overload, in
this case the object overload.
The problem with Reflector, is that it has to *guess* at what type
Nothing is, and it simply picks the first type that comes to mind...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net

<<snip>>

Jan 8 '07 #9
ah- well that would make sense. 2003 1.x
Sorry I didn't specify that up-front.
--

Eric
"Jay B. Harlow [MVP - Outlook]" <Ja************ @tsbradley.netw rote in
message news:ex******** ******@TK2MSFTN GP04.phx.gbl...
VS 2003 (.NET 1.x) or VS 2005 (.NET 2.0)?

The sample I gave compiles in VS 2005; .NET 2.0 has changed what is
allowed to be passed as a parameter to an attribute.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Eric" <er**@ejproduct ions.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>doh- same sort of error with:

DefaultValue(D irectCast(Nothi ng, Image))

Error: "Conversion from 'System.Drawing .Image' to 'System.Object' cannot
occur within a constant expression."

Looks like I'll be sticking with CStr(Nothing).
Thanks again for your help, everyone!

Eric
"Jay B. Harlow [MVP - Outlook]" <Ja************ @tsbradley.netw rote in
message news:Ov******** *****@TK2MSFTNG P04.phx.gbl...
>>Eric,
I normally use:

<DefaultValue(D irectCast(Nothi ng, Image))_
Public Property DefaultImage() As Image
...

As the value of the default is really an Image & not a String.

Granted a String Nothing has exactly the same value as an Image Nothing,
the cast is simply needed so the compiler & pick the correct overload,
in this case the object overload.
The problem with Reflector, is that it has to *guess* at what type
Nothing is, and it simply picks the first type that comes to mind...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net

<<snip>>
Jan 9 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
14219
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method, then use the GetThumbnailImage method to create a second Image. This second one is the one I want to get a FileStream from, so that I can then use its Handle to use Response.WriteFile to output the thumbnail on my ASP.Net page. Any help would...
3
20061
by: anastasia | last post by:
I get an out of memory exception when attempting to excecute the following code: original = System.Drawing.Image.FromFile(file.FileName,true); I ONLY get this exception when the file is in the "My Documents" folder or subfolders. If the file lives anywhere else on the hard drive, I have no problems. What could be going on here?
3
7069
by: alex | last post by:
Hi, I am having an image list with a set of icons i want to use in my application. when using Me.control.Icon = iconList.Images(1) i get the error message Value of type 'System.Drawing.Image' cannot be converted to 'System.Drawing.Icon'.
1
8139
by: Mchuck | last post by:
I've seen several newsgroup topics everywhere concerning this, as well as a couple of articles from the MSDN website, but this error still baffles me. It has to do with using the Image.FromStream(...) function to load an image into a PictureBox control from a byte array received from an SQL Server database. Here's a snippet of what I've been trying to achieve: ----------------------------
4
3638
by: Darrel | last post by:
I'm grabbing a file from a file upload form field. This is a 'system.web.httppostedfile' I would like to modify the image (Cropping/scaling) using system.drawing.image. Is there anyway to go from 'system.web.httppostedfile' directly to 'system.drawing.image'? Normally, I'd grab the System.Drawing.Image from a file itself:
5
3362
by: Jerry J | last post by:
I want to use the System.Drawing.Image class. According to the help file, this is an abstract base class. Because it is supposedly abstract, I created another class that inherits from it. However, when I did this I got the following error: 'System.Drawing.Image.Image()' is inaccessible due to its protection level Looking at other online examples, I found that the proper way to use it is like this:
1
2694
by: Martijn Mulder | last post by:
At startup my application loads an image from a file from disk. If the file is not there, I still need a valid System.Drawing.Image object but I don't know how to get one. //class MyImage class MyImage { //data member image
3
6425
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating imagebuttons which point to a dummy page that takes the image and displays it via response. All works fine if I use explicit paths to a file (response.writefile(<filename>) or directly pass through the database image...
6
621
by: James Hahn | last post by:
That looks like proper Property set code to me. What is the line of code that the designer is generating in the Sub InitializeComponent for a color that you select in the Properties Settings? "Nathan Sokalski" <njsokalski@hotmail.comwrote in message news:er%23hyAFOJHA.1896@TK2MSFTNGP02.phx.gbl...
1
8330
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.