473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Type.GetType()

After the following line:

Type myType1 = Type.GetType("System.Drawing.Color");

myType1 is "undefined". Why is this? I expected it to be type
System.Drawing.Color.

Many thanks.
Feb 21 '06 #1
3 1152
Considering specifying the assembly name.

System.Drawing.Color, System.Drawing

Karl
--
http://www.openmymind.net/

"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
After the following line:

Type myType1 = Type.GetType("System.Drawing.Color");

myType1 is "undefined". Why is this? I expected it to be type
System.Drawing.Color.

Many thanks.

Feb 21 '06 #2
Thanks. Same result.

Is there any other way to check that type of an object? Or to manually
construct a Type to test an object.GetType() against?

- A

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
Considering specifying the assembly name.

System.Drawing.Color, System.Drawing

Karl
--
http://www.openmymind.net/

"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
After the following line:

Type myType1 = Type.GetType("System.Drawing.Color");

myType1 is "undefined". Why is this? I expected it to be type
System.Drawing.Color.

Many thanks.


Feb 21 '06 #3
How odd, it worked for me. You might need to specify the fully quantified
name if it's sitting in the GAC, meaning passing in a public token, culture,
version....

you can check what type an object is via the "is" operator

if (myObject is Drawing)
{
}

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in message
news:Zx******************@newssvr21.news.prodigy.c om...
Thanks. Same result.

Is there any other way to check that type of an object? Or to manually
construct a Type to test an object.GetType() against?

- A

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
Considering specifying the assembly name.

System.Drawing.Color, System.Drawing

Karl
--
http://www.openmymind.net/

"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
After the following line:

Type myType1 = Type.GetType("System.Drawing.Color");

myType1 is "undefined". Why is this? I expected it to be type
System.Drawing.Color.

Many thanks.



Feb 21 '06 #4

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

Similar topics

4
by: Chris Bower | last post by:
Reposted from aspnet.buildingcontrols: Ok, I've got a bunch of derived controls that all have a property Rights of type Rights (Rights is an Enumerator). I wrote a custom TypeConverter so that I...
3
by: Imran Aziz | last post by:
Hello All, I am getting the following error on our production server, and I dont get the same error on the development box. Unable to cast object of type 'System.Byte' to type 'System.String'. ...
2
by: S. Justin Gengo | last post by:
Hi, I've created a component that allows me to store database information for various types of databases my company uses. It uses a collection for each type of database. Everything is working...
6
by: Charles Law | last post by:
I want to do something like this: obj = CType(value, Value.Type) Well, not exactly, but I think that captures the essence. I realise it won't work as I have written it, and it looks a bit like...
12
by: Michael Maes | last post by:
Hello, I have a BaseClass and many Classes which all inherit (directly) from the BaseClass. One of the functions in the BaseClass is to (de)serialize the (inherited) Class to/from disk. ...
16
by: Dennis | last post by:
I have a class named "myclass" and an arraylist containing elements of type "MyClass". I want to get the value of a property of "MyClass" (a string type) for one of the arraylist elements. I...
13
by: Don | last post by:
How do I get an Enum's type using only the Enum name? e.g. Dim enumType as System.Type Dim enumName as String = "MyEnum" enumType = ???(enumName)
3
by: Joe Adams | last post by:
Hi All, How can I use GetType(<GenericType>).IsAssignableFrom(<MyType>) I need to now if the <MyType> is the same type of class as the <GenericType> without having to add the generic type...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.