开发者

Referencing functions within VB6 User Controls

开发者 https://www.devze.com 2022-12-19 18:14 出处:网络
I\'m having an issue referencing public procedures of User Controls that I\'ve created within a VB6 project.

I'm having an issue referencing public procedures of User Controls that I've created within a VB6 project.

A simple example (exe), I have a form with a button and a user control:

Option Explicit

Private Sub Command1_Click()
   UserControl1.updateMessage ("TIME NOW: " & DateTime.Time)
End Sub

The User Control code is as follows:

Option Explicit

Public开发者_JAVA技巧 Sub updateMessage(ByVal newMessage As String)
   Label1.Caption = newMessage
End Sub

This exe compiles and works fine, and when I'm typing updateMessage in the Form, it appears in the intellisense list with the appropriate requirements. The issue I have is when I'm wanting to "go to the definition" of updateMessage, instead of going to the appropriate section of the code within the User Control, the message always returns with:

"Cannot jump to 'updateMessage' because it is in the library 'Unknown1' which is not currently referenced."

where the numbered suffix of "Unkown1" changes from time to time.

It seems that if there were no reference to this procedure, then it would not appear in the intellisense and the project shouldn't compile. When running this with MZTools (though the error appears regardless of this plug-in being installed), I can go into the updateMessage procedure, and use it to find all procedures calling this function, so the link between the two should exist (although I'm not sure if MZTools just finds using a text-matching pattern).

If anyone out there could shed some light on this matter, it would be very much appreciated, and save this poor VB6 developer a lot of hassle!

I have SP6 installed (build 9782) of VB6 and am running XP SP3 on an HP dx2400.


Yes, this is extremely annoying and I'm convinced it's a bug in VB6. I say this because, if you locate the updateMessage method in the object browser and double-click on it, you are taken to the definition. So, the compiler actually does know where the definition is, it just refuses to take you there with Shift+F2.

0

精彩评论

暂无评论...
验证码 换一张
取 消