Hello all,
My editor seems to not accept the following:
Dim color As New System.Drawing. Color
If node.ForeColor Is color.Violet Then Exit Sub
Form1.vb(363): 'Is' requires operands that have reference types, but this
operand has the value type 'System.Drawing .Color'.
where node is Treenode (of Treeview)
Thanks. 7 3853
Color is a struct, not a class, so Is doesn't apply. I'd expect that Color's
Equals() method would do the job. Give it a try.
Tom Dacon
Dacon Software Consulting
"ceasar" <~~> wrote in message news:eu******** ******@TK2MSFTN GP14.phx.gbl... Hello all, My editor seems to not accept the following:
Dim color As New System.Drawing. Color If node.ForeColor Is color.Violet Then Exit Sub
Form1.vb(363): 'Is' requires operands that have reference types, but this operand has the value type 'System.Drawing .Color'.
where node is Treenode (of Treeview)
Thanks.
Many thanks, you have solved the problem :))
Ave Caesar,
"ceasar" schrieb My editor seems to not accept the following:
Dim color As New System.Drawing. Color If node.ForeColor Is color.Violet Then Exit Sub
Form1.vb(363): 'Is' requires operands that have reference types, but this operand has the value type 'System.Drawing .Color'.
Dont ask me why this works, just pass the rubikon (Herfried and Cor surely
will explain it to you in detail, they are both educated in ancient history
and therefore know VB-Syntax better than I do ;-)
This works:
TreeView1.Nodes .Add("Hello World")
TreeView1.Nodes (0).ForeColor = Color.OldLace
Dim retVal As Boolean
retVal = Color.op_Equali ty(TreeView1.No des(0).ForeColo r, Color.OldLace)
If retVal = True Then
MsgBox("Yo")
End If
Cheers
Arne Janning
Arne,
(I do not know what "Ave" is in the old germanic way, however probably
something people would misunderstand so let me not do that)
"Is" is about the reference too an object
"=" is about the contents (value)
You can try this one.
Dim a As DataSet
Dim b As Object
If a Is b Then _
MessageBox.Show ("There is no dataset")
a = New DataSet
If Not a Is b Then _
MessageBox.Show ("There is a dataset")
An not instanced object Is the same as Nothing
When you set
a = New Dataset, you set the value(address) of the reference from "a" to the
new created dataset because "a" is an object
When you set
dim a as integer = 1 you set the value of "a" too 1 because "a" is a value.
Is it not simple?
Cor
"Arne Janning" <sp************ *****@msn.com> Ave Caesar,
"ceasar" schrieb My editor seems to not accept the following:
Dim color As New System.Drawing. Color If node.ForeColor Is color.Violet Then Exit Sub
Form1.vb(363): 'Is' requires operands that have reference types, but this operand has the value type 'System.Drawing .Color'.
Dont ask me why this works, just pass the rubikon (Herfried and Cor surely will explain it to you in detail, they are both educated in ancient history and therefore know VB-Syntax better than I do ;-)
This works:
TreeView1.Nodes .Add("Hello World") TreeView1.Nodes (0).ForeColor = Color.OldLace
Dim retVal As Boolean retVal = Color.op_Equali ty(TreeView1.No des(0).ForeColo r, Color.OldLace)
If retVal = True Then MsgBox("Yo") End If
Cheers
Arne Janning
"Arne Janning" <sp************ *****@msn.com> schrieb: My editor seems to not accept the following:
Dim color As New System.Drawing. Color If node.ForeColor Is color.Violet Then Exit Sub
Form1.vb(363): 'Is' requires operands that have reference types, but this operand has the value type 'System.Drawing .Color'.
VB.NET does not support overloading the equality operator, and 'Color' is a
value type, thus 'Is' and '=' cannot be used in this situation.
This works:
TreeView1.Nodes .Add("Hello World") TreeView1.Nodes (0).ForeColor = Color.OldLace
Dim retVal As Boolean retVal = Color.op_Equali ty(TreeView1.No des(0).ForeColo r, Color.OldLace)
.... or...
\\\
RetVal = TreeView1.Nodes (0).ForeColor.E quals(Color.Old Lace)
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Hi Herfried!
"Herfried K. Wagner [MVP]" schrieb VB.NET does not support overloading the equality operator, and 'Color' is a value type, thus 'Is' and '=' cannot be used in this situation.
Thanks for the concise explanation!
Cheers
AJ
Hi Herfried!
"Herfried K. Wagner [MVP]" schrieb VB.NET does not support overloading the equality operator, and 'Color' is a value type, thus 'Is' and '=' cannot be used in this situation.
Thanks for the concise explanation!
Cheers
AJ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin Michael Reed |
last post by:
------=_NextPart_000_002B_01C34DF8.C34C94F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Assistance required.
I have 3 tables:
|
by: Phil Powell |
last post by:
I am not sure why this is producing a SQL Server related error, but w/o
having an instance of SQL Server on my machine to verify anything further,
can you all help me with this?
<!--- validate() --->
<cffunction name="validate" access="remote" returnType="numeric">
<cfargument name="username" required="yes" type="string" />
<cfargument name="password" required="yes" type="string" />
<cfquery name="validate" datasource="#request.dsn#">
|
by: mar00ned |
last post by:
Hi,
I have a written a custom allocator for STL, on the lines of default
allocator as follows :
template <class T>
class pool_allocator
{
public:
typedef size_t size_type;
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: drose0927 |
last post by:
Please help! I can't get my program to exit if the user hits the
Escape button:
When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this
error:
Parse Error, expecting `'}''
'else if (choice == 27) exit(0) } }'
Here is my program (Simple loop to display currency equivalencies based
| |
by: Steve Long |
last post by:
Hello,
I have a VB.NET class that raises a MapSet event that passes an argument of
type interop.MapObjects2.MapClass.
I have a C# class that inherits from this VB.NET class. How can I handle the
VB.NET event in the C# class?
In VB.NET, you would just write:
Handles MyBase.MapSet
I would appreciate any help on this.
|
by: Siv |
last post by:
Hi,
If I run the following:
strSQL = "Select * FROM Clients;"
da = New OleDb.OleDbDataAdapter(strSQL, Conn) 'Create data adapter
cb = New OleDb.OleDbCommandBuilder(da) 'Create command builder using the datadapter
dt = New Data.DataTable
da.Fill(dt) 'pour in the data using the adapter
|
by: toch3 |
last post by:
i am writing a c program that is basically an address book. the only
header we are using is #include<stdio.hwe are to use a global array,
loops, and pointers. we are to have a menu at the beginning. 1. add new
record 2. search for a record 3 modify a record 4. delete a record 5.
view all records 6.exit in each of these menu's we are to be able to
print the record to an exterior printer.
: i have started my global array, and program, but...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted
********************************************************
For this teeny job, please refer to:
http://feeds.reddit.com/feed/8fu/?o=25
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
| |