473,387 Members | 1,859 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,387 software developers and data experts.

Function expecting System.Guid - invalid cast problem

Hi there,

I'm trying to utilize the WSUS API to create my own custom reporting
agents.

I'm using iUpdateServer.GetComputerTargetGroup, which is defined as
follows:
Public Function GetComputerTargetGroup( _
ByVal id As Guid _
) As IComputerTargetGroup
Implements IUpdateServer.GetComputerTargetGroup

My code is as follows:
For Each targetGroup As IComputerTargetGroup In ComputerGroups
Computers = iUpdateServer.GetComputerTargetGroup(targetGroup.I d)
....

targetGroup.Id is of type System.Guid. Whenever I pass targetGroup.id
to the GetComputerTargetGroup function, I get the following error:

System.InvalidCastException: Specified cast is not valid.

Any ideas as to what I'm doing wrong?

Thank you for any help!
--Nick

Aug 29 '05 #1
2 1887
Turn Option Strict On. Odds are you will find the error at compile time,
perhaps it is happening elsewhere.

<cr*******@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hi there,

I'm trying to utilize the WSUS API to create my own custom reporting
agents.

I'm using iUpdateServer.GetComputerTargetGroup, which is defined as
follows:
Public Function GetComputerTargetGroup( _
ByVal id As Guid _
) As IComputerTargetGroup
Implements IUpdateServer.GetComputerTargetGroup

My code is as follows:
For Each targetGroup As IComputerTargetGroup In ComputerGroups
Computers = iUpdateServer.GetComputerTargetGroup(targetGroup.I d)
...

targetGroup.Id is of type System.Guid. Whenever I pass targetGroup.id
to the GetComputerTargetGroup function, I get the following error:

System.InvalidCastException: Specified cast is not valid.

Any ideas as to what I'm doing wrong?

Thank you for any help!
--Nick

Aug 29 '05 #2
That revealed the problem right away.

Thanks a bunch!

--Nick

Aug 29 '05 #3

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

Similar topics

1
by: | last post by:
When I execute the following (with an OleDBDataAdapter), wanting to add a row to a visual foxpro table: myrow= datasetTarget.Tables(0).NewRow 'fill all columns here like.. row(i)= myvalue '...
89
by: Sweety | last post by:
hi, Is main function address is 657. its show in all compiler. try it & say why? bye,
2
by: collinm | last post by:
hi i got some error with parameter my searchFile function: char *tmp; int size; ....
3
by: Eagle | last post by:
How do I convert a Guid to a string? I am trying to retrieve a value from a dataview into a string variable: CurrentValue = drv(strColumn) and it works fine until the strColumn is a guid...
5
by: rcolby | last post by:
Evening, Wondering if someone can point me in the right direction, on how I would compare a system.guid with a system.byte. system.guid (pulled from sql server table with a data type of...
2
by: crawfordn | last post by:
Hi there, I'm trying to utilize the WSUS API to create my own custom reporting agents. I'm using iUpdateServer.GetComputerTargetGroup, which is defined as follows: Public Function...
1
by: Horace Nunley | last post by:
I'm expecting this function to return the same value each time the page is hit within the same session: In other words i want to save the guid as a session variable Function TempImageGUID() As...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
7
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
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...
0
Oralloy
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,...

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.