Vb.net 添加的功能未显示在COM对象中
我在VB.Net中创建了一个dll,用于Visual Foxpro应用程序。最近,我添加了一些函数来帮助清理数据和清除用户控件的输入,并重新构建了项目。我目前正在使用Regasm注册dll,这似乎工作得很好。然而,当我注册dll时,新的功能并没有显示出来,这使得人们似乎仍然在使用以前注册的旧dll。有什么事我做得不对吗? 下面是代码的摘录Vb.net 添加的功能未显示在COM对象中,vb.net,com,visual-foxpro,Vb.net,Com,Visual Foxpro,我在VB.Net中创建了一个dll,用于Visual Foxpro应用程序。最近,我添加了一些函数来帮助清理数据和清除用户控件的输入,并重新构建了项目。我目前正在使用Regasm注册dll,这似乎工作得很好。然而,当我注册dll时,新的功能并没有显示出来,这使得人们似乎仍然在使用以前注册的旧dll。有什么事我做得不对吗? 下面是代码的摘录 <ClassInterface(ClassInterfaceType.AutoDispatch), ProgId("LPFPasserelle.
<ClassInterface(ClassInterfaceType.AutoDispatch), ProgId("LPFPasserelle.FicheEtablissement")>
Public Class FicheEtablissement
Private mCreateInstitution As New CreateInstitution
<ComRegisterFunction()>
Public Shared Sub RegisterClass(ByVal key As String)
Dim sb As StringBuilder = New StringBuilder(key)
sb.Replace("HKEY_CLASSES_ROOT\", "")
'// Open the CLSID\{guid} key for write access
Dim k As RegistryKey = Registry.ClassesRoot.OpenSubKey(sb.ToString(), True)
Dim ctrl As RegistryKey = k.CreateSubKey("Control")
ctrl.Close()
'// Next create the CodeBase entry - needed if not string named and GACced.
Dim inprocServer32 As RegistryKey = k.OpenSubKey("InprocServer32", True)
inprocServer32.SetValue("CodeBase", Assembly.GetExecutingAssembly().CodeBase)
inprocServer32.Close()
k.Close()
End Sub
<ComUnregisterFunction()>
Public Shared Sub UnregisterClass(ByVal key As String)
Dim sb As StringBuilder = New StringBuilder(key)
sb.Replace("HKEY_CLASSES_ROOT\", "")
'// Open HKCR\CLSID\{guid} for write access
Dim k As RegistryKey = Registry.ClassesRoot.OpenSubKey(sb.ToString(), True)
'// Delete the 'Control' key, but don't throw an exception if it does not exist
If k Is Nothing Then
Return
End If
k.DeleteSubKey("Control", False)
'// Next open up InprocServer32
Dim inprocServer32 As RegistryKey = k.OpenSubKey("InprocServer32", True)
'// And delete the CodeBase key, again not throwing if missing
inprocServer32.DeleteSubKey("CodeBase", False)
'// Finally close the main key
inprocServer32.Close()
k.Close()
End Sub
不确定是否存在清理dll/COM问题,但对于清理字符串,我不知道为什么不使用VFP的函数STRTRAN() someString=[发生了什么事] ??STRTRAN(someString,“,”) 将导致 发生什么事了
通过将字符串中的每个字符替换为其他字符,将字符串中的无效字符剥离为伪加密,具有广泛的好处…在注册新程序集之前是否注销旧程序集?您确定在注册时指向新程序集吗?是。注销和注册是通过批处理文件完成的。我甚至创建并注册了.tlb文件,但似乎没有任何效果。dll是在vb.net中创建的,包含捕获和保存数据所需的所有功能。使用此dll的软件是在vfp中完成的。这就是为什么我没有使用那些函数-STRTRAN()和CHRTRAN()@Jay。。。对的如果您使用VFP来完成工作并调用VB.net dll,则不需要VB.net dll。默认情况下,这些函数内置于VFP中,您可以直接使用它们。不需要外部dll功能。我需要完成的任务无法从VFP完成,因此使用.NET dll。Vfp只是使用dll,因为原始软件是在VFP9中完成的
Function SanitizeStringData(ByVal StringToSanitize As String)
Dim mSanitizedString As String = String.Empty
mSanitizedString = Trim(StringToSanitize)
If Trim(StringToSanitize).Contains("'") Then
mSanitizedString = Trim(StringToSanitize).Replace("'", "''")
End If
Return mSanitizedString
End Function