|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DirectoryServices Cast Error?Using: Vstudio 2005, XP, .NET 2.0 I'm getting the following error when running my code below. I'm passing an object array which contains other variables. It happens immediately when it hits the "For" loop: Unable to cast COM object of type 'System.__ComObject' to interface type 'IDirectorySearch'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). I also have a problem where in my "New" method, it gives me a late binding error with option strict on. I'm basically creating multiple threads from this thread to go and do some time consuming work, which doesn't require much processing power or resources. Option Strict Off Imports System.Text.RegularExpressions Public Class controlThreadClass Dim svrInfo As serverInfo Dim mtDict As Dictionary(Of Integer, String) Dim svrResults As System.DirectoryServices.SearchResultCollection Dim threadList As System.Collections.ArrayList Dim objSrvr As System.DirectoryServices.SearchResult Public Sub New(ByVal obj As Object) svrInfo = DirectCast(obj(0), serverInfo) mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) svrResults = DirectCast(obj(2), System.DirectoryServices.SearchResultCollection) End Sub Public Sub ControlThread() 'This thread keeps the UI responsive and manages the serverThread threads Dim i2 As Integer = 1 Dim sThread As System.Threading.Thread Dim creds As New secCreds Dim su As New SwitchUser Dim serverThread As serverThreadClass Dim serverThreadVals As Object Dim strVal As String 'Here's where my error occurs, as soon as you hit the "For" loop... For Each objSrvr In svrResults ....other code here..... End If i2 += 1 Next End Sub End Class Your calling thread and thread it is on must match.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=451863&SiteID=1 Show quoteHide quote "Bmack500" <brett.m***@gmail.com> wrote in message news:1166732194.589483.318210@a3g2000cwd.googlegroups.com... > Hello, and Thanks in advance! > Using: Vstudio 2005, XP, .NET 2.0 > > I'm getting the following error when running my code below. I'm > passing an object array which contains other variables. It happens > immediately when it hits the "For" loop: > > Unable to cast COM object of type 'System.__ComObject' to interface > type 'IDirectorySearch'. This operation failed because the > QueryInterface call on the COM component for the interface with IID > '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following > error: No such interface supported (Exception from HRESULT: 0x80004002 > (E_NOINTERFACE)). > > I also have a problem where in my "New" method, it gives me a late > binding error with option strict on. > > I'm basically creating multiple threads from this thread to go and do > some time consuming work, which doesn't require much processing power > or resources. > > Option Strict Off > Imports System.Text.RegularExpressions > Public Class controlThreadClass > Dim svrInfo As serverInfo > Dim mtDict As Dictionary(Of Integer, String) > Dim svrResults As System.DirectoryServices.SearchResultCollection > Dim threadList As System.Collections.ArrayList > Dim objSrvr As System.DirectoryServices.SearchResult > > Public Sub New(ByVal obj As Object) > svrInfo = DirectCast(obj(0), serverInfo) > mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) > svrResults = DirectCast(obj(2), > System.DirectoryServices.SearchResultCollection) > End Sub > > Public Sub ControlThread() > 'This thread keeps the UI responsive and manages the > serverThread threads > Dim i2 As Integer = 1 > > Dim sThread As System.Threading.Thread > Dim creds As New secCreds > Dim su As New SwitchUser > Dim serverThread As serverThreadClass > Dim serverThreadVals As Object > Dim strVal As String > > 'Here's where my error occurs, as soon as you hit the "For" loop... > For Each objSrvr In svrResults > > ....other code here..... > End If > i2 += 1 > Next > > End Sub > End Class > Could you elaborate? Match in what way? Sorry, I'm diving head first
into multithreading; waiting for some books to arrive! vbnetdev wrote: Show quoteHide quote > Your calling thread and thread it is on must match. > > http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=451863&SiteID=1 > > > "Bmack500" <brett.m***@gmail.com> wrote in message > news:1166732194.589483.318210@a3g2000cwd.googlegroups.com... > > Hello, and Thanks in advance! > > Using: Vstudio 2005, XP, .NET 2.0 > > > > I'm getting the following error when running my code below. I'm > > passing an object array which contains other variables. It happens > > immediately when it hits the "For" loop: > > > > Unable to cast COM object of type 'System.__ComObject' to interface > > type 'IDirectorySearch'. This operation failed because the > > QueryInterface call on the COM component for the interface with IID > > '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following > > error: No such interface supported (Exception from HRESULT: 0x80004002 > > (E_NOINTERFACE)). > > > > I also have a problem where in my "New" method, it gives me a late > > binding error with option strict on. > > > > I'm basically creating multiple threads from this thread to go and do > > some time consuming work, which doesn't require much processing power > > or resources. > > > > Option Strict Off > > Imports System.Text.RegularExpressions > > Public Class controlThreadClass > > Dim svrInfo As serverInfo > > Dim mtDict As Dictionary(Of Integer, String) > > Dim svrResults As System.DirectoryServices.SearchResultCollection > > Dim threadList As System.Collections.ArrayList > > Dim objSrvr As System.DirectoryServices.SearchResult > > > > Public Sub New(ByVal obj As Object) > > svrInfo = DirectCast(obj(0), serverInfo) > > mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) > > svrResults = DirectCast(obj(2), > > System.DirectoryServices.SearchResultCollection) > > End Sub > > > > Public Sub ControlThread() > > 'This thread keeps the UI responsive and manages the > > serverThread threads > > Dim i2 As Integer = 1 > > > > Dim sThread As System.Threading.Thread > > Dim creds As New secCreds > > Dim su As New SwitchUser > > Dim serverThread As serverThreadClass > > Dim serverThreadVals As Object > > Dim strVal As String > > > > 'Here's where my error occurs, as soon as you hit the "For" loop... > > For Each objSrvr In svrResults > > > > ....other code here..... > > End If > > i2 += 1 > > Next > > > > End Sub > > End Class > > Make sure the declaration of the object and the actions that occur with the
object exist in the same thread. Show quoteHide quote "Bmack500" <brett.m***@gmail.com> wrote in message news:1166738300.143150.43680@a3g2000cwd.googlegroups.com... > Could you elaborate? Match in what way? Sorry, I'm diving head first > into multithreading; waiting for some books to arrive! > > vbnetdev wrote: >> Your calling thread and thread it is on must match. >> >> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=451863&SiteID=1 >> >> >> "Bmack500" <brett.m***@gmail.com> wrote in message >> news:1166732194.589483.318210@a3g2000cwd.googlegroups.com... >> > Hello, and Thanks in advance! >> > Using: Vstudio 2005, XP, .NET 2.0 >> > >> > I'm getting the following error when running my code below. I'm >> > passing an object array which contains other variables. It happens >> > immediately when it hits the "For" loop: >> > >> > Unable to cast COM object of type 'System.__ComObject' to interface >> > type 'IDirectorySearch'. This operation failed because the >> > QueryInterface call on the COM component for the interface with IID >> > '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following >> > error: No such interface supported (Exception from HRESULT: 0x80004002 >> > (E_NOINTERFACE)). >> > >> > I also have a problem where in my "New" method, it gives me a late >> > binding error with option strict on. >> > >> > I'm basically creating multiple threads from this thread to go and do >> > some time consuming work, which doesn't require much processing power >> > or resources. >> > >> > Option Strict Off >> > Imports System.Text.RegularExpressions >> > Public Class controlThreadClass >> > Dim svrInfo As serverInfo >> > Dim mtDict As Dictionary(Of Integer, String) >> > Dim svrResults As System.DirectoryServices.SearchResultCollection >> > Dim threadList As System.Collections.ArrayList >> > Dim objSrvr As System.DirectoryServices.SearchResult >> > >> > Public Sub New(ByVal obj As Object) >> > svrInfo = DirectCast(obj(0), serverInfo) >> > mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) >> > svrResults = DirectCast(obj(2), >> > System.DirectoryServices.SearchResultCollection) >> > End Sub >> > >> > Public Sub ControlThread() >> > 'This thread keeps the UI responsive and manages the >> > serverThread threads >> > Dim i2 As Integer = 1 >> > >> > Dim sThread As System.Threading.Thread >> > Dim creds As New secCreds >> > Dim su As New SwitchUser >> > Dim serverThread As serverThreadClass >> > Dim serverThreadVals As Object >> > Dim strVal As String >> > >> > 'Here's where my error occurs, as soon as you hit the "For" loop... >> > For Each objSrvr In svrResults >> > >> > ....other code here..... >> > End If >> > i2 += 1 >> > Next >> > >> > End Sub >> > End Class >> > > Any chance you could provide a quick example? Sorry, I hate to
impose.... vbnetdev wrote: Show quoteHide quote > Make sure the declaration of the object and the actions that occur with the > object exist in the same thread. > > > "Bmack500" <brett.m***@gmail.com> wrote in message > news:1166738300.143150.43680@a3g2000cwd.googlegroups.com... > > Could you elaborate? Match in what way? Sorry, I'm diving head first > > into multithreading; waiting for some books to arrive! > > > > vbnetdev wrote: > >> Your calling thread and thread it is on must match. > >> > >> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=451863&SiteID=1 > >> > >> > >> "Bmack500" <brett.m***@gmail.com> wrote in message > >> news:1166732194.589483.318210@a3g2000cwd.googlegroups.com... > >> > Hello, and Thanks in advance! > >> > Using: Vstudio 2005, XP, .NET 2.0 > >> > > >> > I'm getting the following error when running my code below. I'm > >> > passing an object array which contains other variables. It happens > >> > immediately when it hits the "For" loop: > >> > > >> > Unable to cast COM object of type 'System.__ComObject' to interface > >> > type 'IDirectorySearch'. This operation failed because the > >> > QueryInterface call on the COM component for the interface with IID > >> > '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following > >> > error: No such interface supported (Exception from HRESULT: 0x80004002 > >> > (E_NOINTERFACE)). > >> > > >> > I also have a problem where in my "New" method, it gives me a late > >> > binding error with option strict on. > >> > > >> > I'm basically creating multiple threads from this thread to go and do > >> > some time consuming work, which doesn't require much processing power > >> > or resources. > >> > > >> > Option Strict Off > >> > Imports System.Text.RegularExpressions > >> > Public Class controlThreadClass > >> > Dim svrInfo As serverInfo > >> > Dim mtDict As Dictionary(Of Integer, String) > >> > Dim svrResults As System.DirectoryServices.SearchResultCollection > >> > Dim threadList As System.Collections.ArrayList > >> > Dim objSrvr As System.DirectoryServices.SearchResult > >> > > >> > Public Sub New(ByVal obj As Object) > >> > svrInfo = DirectCast(obj(0), serverInfo) > >> > mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) > >> > svrResults = DirectCast(obj(2), > >> > System.DirectoryServices.SearchResultCollection) > >> > End Sub > >> > > >> > Public Sub ControlThread() > >> > 'This thread keeps the UI responsive and manages the > >> > serverThread threads > >> > Dim i2 As Integer = 1 > >> > > >> > Dim sThread As System.Threading.Thread > >> > Dim creds As New secCreds > >> > Dim su As New SwitchUser > >> > Dim serverThread As serverThreadClass > >> > Dim serverThreadVals As Object > >> > Dim strVal As String > >> > > >> > 'Here's where my error occurs, as soon as you hit the "For" loop... > >> > For Each objSrvr In svrResults > >> > > >> > ....other code here..... > >> > End If > >> > i2 += 1 > >> > Next > >> > > >> > End Sub > >> > End Class > >> > > > Zip and send me your project and I will see what I can do.
Show quoteHide quote "Bmack500" <brett.m***@gmail.com> wrote in message news:1166745806.195146.190780@48g2000cwx.googlegroups.com... > Any chance you could provide a quick example? Sorry, I hate to > impose.... > > vbnetdev wrote: >> Make sure the declaration of the object and the actions that occur with >> the >> object exist in the same thread. >> >> >> "Bmack500" <brett.m***@gmail.com> wrote in message >> news:1166738300.143150.43680@a3g2000cwd.googlegroups.com... >> > Could you elaborate? Match in what way? Sorry, I'm diving head first >> > into multithreading; waiting for some books to arrive! >> > >> > vbnetdev wrote: >> >> Your calling thread and thread it is on must match. >> >> >> >> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=451863&SiteID=1 >> >> >> >> >> >> "Bmack500" <brett.m***@gmail.com> wrote in message >> >> news:1166732194.589483.318210@a3g2000cwd.googlegroups.com... >> >> > Hello, and Thanks in advance! >> >> > Using: Vstudio 2005, XP, .NET 2.0 >> >> > >> >> > I'm getting the following error when running my code below. I'm >> >> > passing an object array which contains other variables. It happens >> >> > immediately when it hits the "For" loop: >> >> > >> >> > Unable to cast COM object of type 'System.__ComObject' to interface >> >> > type 'IDirectorySearch'. This operation failed because the >> >> > QueryInterface call on the COM component for the interface with IID >> >> > '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following >> >> > error: No such interface supported (Exception from HRESULT: >> >> > 0x80004002 >> >> > (E_NOINTERFACE)). >> >> > >> >> > I also have a problem where in my "New" method, it gives me a late >> >> > binding error with option strict on. >> >> > >> >> > I'm basically creating multiple threads from this thread to go and >> >> > do >> >> > some time consuming work, which doesn't require much processing >> >> > power >> >> > or resources. >> >> > >> >> > Option Strict Off >> >> > Imports System.Text.RegularExpressions >> >> > Public Class controlThreadClass >> >> > Dim svrInfo As serverInfo >> >> > Dim mtDict As Dictionary(Of Integer, String) >> >> > Dim svrResults As System.DirectoryServices.SearchResultCollection >> >> > Dim threadList As System.Collections.ArrayList >> >> > Dim objSrvr As System.DirectoryServices.SearchResult >> >> > >> >> > Public Sub New(ByVal obj As Object) >> >> > svrInfo = DirectCast(obj(0), serverInfo) >> >> > mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) >> >> > svrResults = DirectCast(obj(2), >> >> > System.DirectoryServices.SearchResultCollection) >> >> > End Sub >> >> > >> >> > Public Sub ControlThread() >> >> > 'This thread keeps the UI responsive and manages the >> >> > serverThread threads >> >> > Dim i2 As Integer = 1 >> >> > >> >> > Dim sThread As System.Threading.Thread >> >> > Dim creds As New secCreds >> >> > Dim su As New SwitchUser >> >> > Dim serverThread As serverThreadClass >> >> > Dim serverThreadVals As Object >> >> > Dim strVal As String >> >> > >> >> > 'Here's where my error occurs, as soon as you hit the "For" loop... >> >> > For Each objSrvr In svrResults >> >> > >> >> > ....other code here..... >> >> > End If >> >> > i2 += 1 >> >> > Next >> >> > >> >> > End Sub >> >> > End Class >> >> > >> > > Bmack,
> Any chance you could provide a quick example? Sorry, I hate to We too, you are passing an object. First of all, try to avoid that secondly > impose.... we have not any idea what it can be, as far as I can see is it a Type that holds all kinds of different Types. That makes it in my idea almost impossible to answer your question. Cor Show quoteHide quote "Bmack500" <brett.m***@gmail.com> schreef in bericht news:1166745806.195146.190780@48g2000cwx.googlegroups.com... > Any chance you could provide a quick example? Sorry, I hate to > impose.... > > vbnetdev wrote: >> Make sure the declaration of the object and the actions that occur with >> the >> object exist in the same thread. >> >> >> "Bmack500" <brett.m***@gmail.com> wrote in message >> news:1166738300.143150.43680@a3g2000cwd.googlegroups.com... >> > Could you elaborate? Match in what way? Sorry, I'm diving head first >> > into multithreading; waiting for some books to arrive! >> > >> > vbnetdev wrote: >> >> Your calling thread and thread it is on must match. >> >> >> >> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=451863&SiteID=1 >> >> >> >> >> >> "Bmack500" <brett.m***@gmail.com> wrote in message >> >> news:1166732194.589483.318210@a3g2000cwd.googlegroups.com... >> >> > Hello, and Thanks in advance! >> >> > Using: Vstudio 2005, XP, .NET 2.0 >> >> > >> >> > I'm getting the following error when running my code below. I'm >> >> > passing an object array which contains other variables. It happens >> >> > immediately when it hits the "For" loop: >> >> > >> >> > Unable to cast COM object of type 'System.__ComObject' to interface >> >> > type 'IDirectorySearch'. This operation failed because the >> >> > QueryInterface call on the COM component for the interface with IID >> >> > '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}' failed due to the following >> >> > error: No such interface supported (Exception from HRESULT: >> >> > 0x80004002 >> >> > (E_NOINTERFACE)). >> >> > >> >> > I also have a problem where in my "New" method, it gives me a late >> >> > binding error with option strict on. >> >> > >> >> > I'm basically creating multiple threads from this thread to go and >> >> > do >> >> > some time consuming work, which doesn't require much processing >> >> > power >> >> > or resources. >> >> > >> >> > Option Strict Off >> >> > Imports System.Text.RegularExpressions >> >> > Public Class controlThreadClass >> >> > Dim svrInfo As serverInfo >> >> > Dim mtDict As Dictionary(Of Integer, String) >> >> > Dim svrResults As System.DirectoryServices.SearchResultCollection >> >> > Dim threadList As System.Collections.ArrayList >> >> > Dim objSrvr As System.DirectoryServices.SearchResult >> >> > >> >> > Public Sub New(ByVal obj As Object) >> >> > svrInfo = DirectCast(obj(0), serverInfo) >> >> > mtDict = DirectCast(obj(1), Dictionary(Of Integer, String)) >> >> > svrResults = DirectCast(obj(2), >> >> > System.DirectoryServices.SearchResultCollection) >> >> > End Sub >> >> > >> >> > Public Sub ControlThread() >> >> > 'This thread keeps the UI responsive and manages the >> >> > serverThread threads >> >> > Dim i2 As Integer = 1 >> >> > >> >> > Dim sThread As System.Threading.Thread >> >> > Dim creds As New secCreds >> >> > Dim su As New SwitchUser >> >> > Dim serverThread As serverThreadClass >> >> > Dim serverThreadVals As Object >> >> > Dim strVal As String >> >> > >> >> > 'Here's where my error occurs, as soon as you hit the "For" loop... >> >> > For Each objSrvr In svrResults >> >> > >> >> > ....other code here..... >> >> > End If >> >> > i2 += 1 >> >> > Next >> >> > >> >> > End Sub >> >> > End Class >> >> > >> > >
cut, copy, and paste
Reservation algorithm Sending Email via VB.Net displaying resource file as Help Multithreading with DirectoryServices Sql 2005 and vb 2005 question? Object Type Conversion Error How to collect the data from input created by document.write() in ASP.NET? What would be a good way to add image files to my solution Stopping Windows Service with Thread |
|||||||||||||||||||||||