Search code examples
vb6datamember

Method or data member not found compile issue


I have a VB6 project that I didn't create but I have to update, when I go to make the exe I get a compile error: Method or data member not found, and it points too "SCom1.FileReceive" in the code below. When I look at the Main form, the SCom1 control is a PictureBox.

This code has been working for the last 5 years but I don't know why SCom1 is a picturebox, or why I'm getting the error, is it a reference? SCom1 to me looks like a MSComm function? Let me know if anyone has any ideas, I just don't know VB enough to know how to troubleshoot this. Thanks

If SCom1.FileReceive = True Then   
WriteToLog (Now() & " FileReceive was true, now false")
    SCom1.FileReceive = False
End If

Solution

  • The machine which you have opened the code doesn't have the mscomm32.ocx file or the ocx file not registered properly.

    When vb cannot reference an ocx, it'll convert the relevant control to a picture box control.

    What you have to do is, close the project without saving. Then open system32 folder and check for mscomm32.ocx file. If the file is not there then you have to download that from the intenet. The register the file using regsvr32 command in command prompt.

    After this you can open the vb6 project and start working.

    =========================================================

    EDIT : Included the update in the comments to the answer, this will help other users in the future... :-)

    if the method name doesn't look familiar to a known ocx file (in this case the SCom1.FileReceive), the missing component can be a custom ocx file.

    So check on the working machine or in project folder whether there are any ocx file exists in the relevant name (in this case SCom.ocx).

    if there is a file exists in such name, register that file using regsvr32 (if not registered), then add that to toolbox, then replace the picture box control with the relevant control (make sure the name tally).