472,143 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Type.GetType("System.Drawing.Point")) error...

I'm building a dataset that writes out a Point type value.
Here's the code that I've got:

1 Dim dsContent As DataSet = New DataSet("content")
2 Dim dtAsset As DataTable = New DataTable("asset")
3 Dim dcPk(0) As DataColumn
4 dcPk(0) = _
5 dtAsset.Columns.Add("fullName", Type.GetType("System.String"))
6 dtAsset.Columns.Add("videoLocation",
Type.GetType("System.Drawing.Point"))
7 dtAsset.Columns.Add("videoSize", Type.GetType("System.Drawing.Size"))
8 dtAsset.PrimaryKey = dcPk 'define primary key for this table
9 dsContent.Tables.Add(dtAsset)

The code compiles just fine but always blows up on line #6 stating:

An unhandled exception of type 'System.ArgumentNullException'
occurred in system.data.dll
Additional information: 'dataType' argument cannot be null.

How any idea what the problem is here and how to correct it?
Jan 25 '06 #1
5 4155
By default Type.GetType searched for requested type in mscorlib and in
executing assembly. You have to provide assembly qualified type name,
like

Type.GetType("System.Drawing.Point, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

Jan 25 '06 #2
How any idea what the problem is here and how to correct it?


The problem is that you have to specify the fully qualified type name
which includes the assembly name.

If you have a reference to System.Drawing.dll use the GetType operator
instead.

dtAsset.Columns.Add("videoSize", GetType(System.Drawing.Size))
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 25 '06 #3
Thanks that seems to work for me... where can I find the fully qualified type
name for other types... (like Size, etc.)...

"Vladimir Matveev" wrote:
By default Type.GetType searched for requested type in mscorlib and in
executing assembly. You have to provide assembly qualified type name,
like

Type.GetType("System.Drawing.Point, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

Jan 25 '06 #4
if you have references to assemblies where these types are located, it
will be easier to use typeof() operator

Jan 25 '06 #5
Nope, I don't have refs to the assemblies where these types are located...

Is there an easy way to obtain/determine the fully qualified type name for a
specified type (i.e. Point, Size, etc.)

Thanks for your help!

"Vladimir Matveev" wrote:
if you have references to assemblies where these types are located, it
will be easier to use typeof() operator

Jan 25 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Patrick Olurotimi Ige | last post: by
10 posts views Thread by James Stroud | last post: by
reply views Thread by Manuel | last post: by
reply views Thread by leo001 | last post: by

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.