473,473 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1890
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
marktang
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,...
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
jinu1996
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...
1
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...
0
tracyyun
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...
0
agi2029
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,...
1
isladogs
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.