I have a Windows form where I am trying to set the BackColor of a control
and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
I can apparently do:
control.BackCol or = System.Drawing. Color.Blue
Why can't I test the color?
Thanks,
Tom 11 1923
On Nov 3, 7:58 pm, "tshad" <t...@dslextrem e.comwrote:
I have a Windows form where I am trying to set the BackColor of a control
and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
I can apparently do:
control.BackCol or = System.Drawing. Color.Blue
Why can't I test the color?
Thanks,
Tom
Try using:
If control.BackCol or.Equals(Syste m.Drawing.Color .Blue) Then
....
else
....
end if
--
Tom Shelton
"Tom Shelton" <to*********@co mcast.netwrote in message
news:11******** *************@d 55g2000hsg.goog legroups.com...
On Nov 3, 7:58 pm, "tshad" <t...@dslextrem e.comwrote:
>I have a Windows form where I am trying to set the BackColor of a control and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then ChangeColor(con trol, Color.Red) Else ChangeColor(con trol, Color.Blue) End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and 'System.Drawin g.Color'.
I can apparently do:
control.BackCo lor = System.Drawing. Color.Blue
Why can't I test the color?
Thanks,
Tom
Try using:
If control.BackCol or.Equals(Syste m.Drawing.Color .Blue) Then
That worked.
Where else do I need to use .Equals?
I would assume that if I set a value using an assignment (=), that I would
also be able to test it the same way?
If :
control.BackCol or = System.Drawing. Color.Blue
why not
IF control.BackCol or = System.Drawing. Color.Blue then ...
Thanks,
Tom
...
else
...
end if
--
Tom Shelton
"tshad" <tf*@dslextreme .comschrieb:
>I have a Windows form where I am trying to set the BackColor of a control and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
In addition to the other replies: I assume you are using VB.NET 2002/2003.
Those versions do not yet support operator overloading. With VB 2005, the
code above would compile because VB 2005 supports operator overloading and
'Color' overloads the '=' (comparison) operator.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
On Nov 5, 12:29 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"tshad" <t...@dslextrem e.comschrieb:
I have a Windows form where I am trying to set the BackColor of a control
and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
In addition to the other replies: I assume you are using VB.NET 2002/2003.
Those versions do not yet support operator overloading. With VB 2005, the
code above would compile because VB 2005 supports operator overloading and
'Color' overloads the '=' (comparison) operator.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I was going to ask him if he was using VB.NET 2002/2003 - but then I
realized, he had to be or he wouldn't have gotten the error :)
--
Tom Shelton
"Tom Shelton" <to*********@co mcast.netwrote in message
news:11******** **************@ v23g2000prn.goo glegroups.com.. .
On Nov 5, 12:29 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
>"tshad" <t...@dslextrem e.comschrieb:
>I have a Windows form where I am trying to set the BackColor of a control and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
In addition to the other replies: I assume you are using VB.NET 2002/2003. Those versions do not yet support operator overloading. With VB 2005, the code above would compile because VB 2005 supports operator overloading and 'Color' overloads the '=' (comparison) operator.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I was going to ask him if he was using VB.NET 2002/2003 - but then I
realized, he had to be or he wouldn't have gotten the error :)
You're right.
It is VS.Net 2003.
Tom
>
--
Tom Shelton
On Nov 5, 4:01 pm, "tshad" <t...@dslextrem e.comwrote:
"Tom Shelton" <tom_shel...@co mcast.netwrote in message
news:11******** **************@ v23g2000prn.goo glegroups.com.. .
On Nov 5, 12:29 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"tshad" <t...@dslextrem e.comschrieb:
I have a Windows form where I am trying to set the BackColor of a
control
and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
In addition to the other replies: I assume you are using VB.NET
2002/2003.
Those versions do not yet support operator overloading. With VB 2005,
the
code above would compile because VB 2005 supports operator overloading
and
'Color' overloads the '=' (comparison) operator.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I was going to ask him if he was using VB.NET 2002/2003 - but then I
realized, he had to be or he wouldn't have gotten the error :)
You're right.
It is VS.Net 2003.
Tom
I figured it must be... Those versions don't support operator
overloading. Another way you could have done this is called
op_equality directly, but that is a little more ugly then just
calling .Equals.
Just so you know, in VB.NET 2005 and latter, you could just say:
If control.BackCol or = Color.Red then
--
Tom Shelton
"Tom Shelton" <to*********@co mcast.netwrote in message
news:11******** *************@5 7g2000hsv.googl egroups.com...
On Nov 5, 4:01 pm, "tshad" <t...@dslextrem e.comwrote:
>"Tom Shelton" <tom_shel...@co mcast.netwrote in message
news:11******* *************** @v23g2000prn.go oglegroups.com. ..
On Nov 5, 12:29 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e: "tshad" <t...@dslextrem e.comschrieb:
>I have a Windows form where I am trying to set the BackColor of a control and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
>In addition to the other replies: I assume you are using VB.NET 2002/2003. Those versions do not yet support operator overloading. With VB 2005, the code above would compile because VB 2005 supports operator overloading and 'Color' overloads the '=' (comparison) operator.
>-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I was going to ask him if he was using VB.NET 2002/2003 - but then I
realized, he had to be or he wouldn't have gotten the error :)
You're right.
It is VS.Net 2003.
Tom
I figured it must be... Those versions don't support operator
overloading. Another way you could have done this is called
op_equality directly, but that is a little more ugly then just
calling .Equals.
Just so you know, in VB.NET 2005 and latter, you could just say:
If control.BackCol or = Color.Red then
That's great.
I am hoping some of the other objects on forms are easier to deal with as
they are in asp.net, such as DataGrid. I'm sure you've noticed I have asked
a lot of questions about DataGrids for forms. Handling it is not as
intuitive as for the DataGrid on Asp.Net. Most of the objects are have the
same of similar methods and attributes such as getting number of rows or
getting data from the object. On windows forms, it doesn't seem to be a
straight forward.
Thanks,
Tom
>
--
Tom Shelton
On Nov 6, 2:49 pm, "tshad" <t...@dslextrem e.comwrote:
"Tom Shelton" <tom_shel...@co mcast.netwrote in message
news:11******** *************@5 7g2000hsv.googl egroups.com...
On Nov 5, 4:01 pm, "tshad" <t...@dslextrem e.comwrote:
"Tom Shelton" <tom_shel...@co mcast.netwrote in message
>news:11******* *************** @v23g2000prn.go oglegroups.com. ..
On Nov 5, 12:29 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"tshad" <t...@dslextrem e.comschrieb:
I have a Windows form where I am trying to set the BackColor of a
control
and check the color before I do it:
If control.BackCol or = System.Drawing. Color.Blue Then
ChangeColor(con trol, Color.Red)
Else
ChangeColor(con trol, Color.Blue)
End If
But I get an error:
Operator '=' is not defined for types 'System.Drawing .Color' and
'System.Drawing .Color'.
In addition to the other replies: I assume you are using VB.NET
2002/2003.
Those versions do not yet support operator overloading. With VB 2005,
the
code above would compile because VB 2005 supports operator overloading
and
'Color' overloads the '=' (comparison) operator.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I was going to ask him if he was using VB.NET 2002/2003 - but then I
realized, he had to be or he wouldn't have gotten the error :)
You're right.
It is VS.Net 2003.
Tom
I figured it must be... Those versions don't support operator
overloading. Another way you could have done this is called
op_equality directly, but that is a little more ugly then just
calling .Equals.
Just so you know, in VB.NET 2005 and latter, you could just say:
If control.BackCol or = Color.Red then
That's great.
I am hoping some of the other objects on forms are easier to deal with as
they are in asp.net, such as DataGrid.
I don't know - asp.net and windows forms are completely different on
most things, when it comes to controls :) Comming form an asp.net
background you might find WPF a little more to your liking.
I'm sure you've noticed I have asked
a lot of questions about DataGrids for forms. Handling it is not as
intuitive as for the DataGrid on Asp.Net. Most of the objects are have the
same of similar methods and attributes such as getting number of rows or
getting data from the object. On windows forms, it doesn't seem to be a
straight forward.
Thanks,
Tom
As for the DataGrid - wish I could help you there. I'm not much of a
datagrid person. I do know that in 2005, they have deprecated the
datagrid completely (well, almost completely, the only place you would
use it is if you need to display your data in a hiearchial format).
The replacement is the DataGridView. You usually hook it to a
BindingSource, etc, etc....
To be honest, most of my grid experience has been with the Janus
Grid :)
--
Tom Shelton
Tom,
I would not see direct the DataGridView as a replacement for a windows form
DataGrid.
A datagrid can show datasets, a DataGridView only single tables of that
however too all kind of other classes. It is a complete different complex
data control).
Although I agree that in the DataGridView the problems in from the DataGrid
are not repeated in the DataGridView.
Ken has specialized himself a little bit in it, we have together a website. http://www.vb-tips.com/default.aspx
The website needs revision, we have probably used to much Ajax in it, it is
fast but not easy to handle.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: perspolis |
last post by:
HI
I created a user control and place some control on it.
I need when I change BackColor of user control,Back Color of other controls
also change..
I used foloowing code:
public override Color BackColor
{
get{return this.BackColor;}
set{
this.BackColor=value;
|
by: CVerma |
last post by:
Hi,
I have an embedded datagrid within a datalist. I am not able to
perfrom paging in the datagrid. Any ideas? Here is my code:
Here is my Simplegrid.cs file:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
|
by: Firewalker |
last post by:
I am attempting to change the backColor property on the previously
instantiated buttons FROM a listbox_doubleClick event.
I thought it would be something like this:
If Me.Controls.Item(iSeatNumber).BackColor.Equals(Color.White) Then
Me.Controls.Item(iSeatNumber).BackColor.Equals(Color.CornflowerBlue)
'End If
|
by: Try Guy |
last post by:
I would like the background of a button so pulsate between to given colors
with the speed of a given timeinterval... I have two questions:
What can I use to control the interval thing with? I guess a Timer.. maybe?
is this fast enough to use as a mouseover effect on a Button?
How do I go from one color to another? Is there any built in functions for
these things or do I have to figure this out myself?
regards
|
by: senfo |
last post by:
I developed a Windows control in VS 2005 that inherits from the
PictureBox Control that adds the ability to select images in a Windows
application. It is, however, experiencing a strange issue that I can't
explain. One of the desired affects was to provide the ability to
change the background color on images that were selected, as well as
setting the background color back to its original color after the image
had been deselected.
To...
| |
by: jfolland |
last post by:
I am trying to add a basic user control to a web site; coming from
visual
studio 2003 this was extremely easy. I would just add the user
control and
then add the controls that I want on that user control, but I am not
able to
get a basic link button to click. This seems so ridiculously basic,
but I am
not able to get this to work. What am I missing?
|
by: Rob |
last post by:
This should be simple.....
The default BackColor of a button (if you look at its property) is "Control"
its a gray color, but apparently not a color.
During a process I set the BackColor of a button to another color by
using....
Me.Button.BackColor = Color.Yellow
|
by: Dmitry Duginov |
last post by:
Hi,
I have the following label markup (label is inside FormView):
<asp:Label
ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready"
BackColor='<%#
Eval("Ready").ToString()=="True"?System.Drawing.Color.FromName("#FFFF80"):System.Drawing.Color.White
%>'
Enabled='<%# Eval("Ready") %>'
|
by: Rob |
last post by:
Hi,
I'am working with vb2005 and it's an ADO application based on an access
database.
i'am still have problems to get the backcolor of an control in a different
color if it has the focus.
I am searching for a routine which automacticly highligt the control
(textbox, cbo, groupbox) if he is focused instead to program each control
separatly by gotfocus and lostfocus. (Me.BackColor = Color.YellowGreen)
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
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
| |