CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2013
    Posts
    4

    vb6 property missing from method

    I have two machines -- 1st one is my development machine, and the 2nd is a laptop with a copy of the program -- both are running identical versions of Windows 7 Ultimate.
    My dll I'm using works on all the methods/properties on both machines except the development machine doesn't have the options for the properties of one method
    Development machine:

    Sub RecordsetReport()
    Member of PrintPreview5.Preview
    Create a report from a recordset

    On Laptop

    Sub RecordsetReport(oRecordset As Recordset, [Headers As Boolean = False], [bWidths As Boolean = False], [etsStep As eAutoStep = 1])
    Member of PrintPreview5.Preview
    Create a report from a recordset.

    On the development machine I have removed the dll from the references of the project, unregistered the dll, copied from the laptop, then registrated the dll, then added back to references --no effect

    I have uninstalled vb6 and reinstalled -- no effect (both sp6)

    I have checked the project references and components to verify that the exact copies were on development machine that is on the laptop. Also they are in same order (remember something from past that some references/components didn't work unless they were in same order).

    I open some access datasets, so I don't think that is the issue.

    What's really strange is that this RecordsetReport method is the only one that doesn't work.

    I have grabbed the source on the development machine from the laptop and it works there

    A snippet of the code is below:

    Set cn = New Connection
    cn.ConnectionString = "Provider=MSDASQL.2; Data Source=" & sConnect
    cn.CursorLocation = adUseServer
    MousePointer = 11
    On Error Resume Next
    cn.Open
    Dim RS1 As Recordset
    Set RS1 = New Recordset
    RS1.CursorType = adOpenForwardOnly
    On Error Resume Next
    Call ParseSQL(Text1.Text, text1text)
    RS1.Open text1text, cn, adOpenStatic, adLockReadOnly, adCmdText
    MousePointer = 0
    Set MSHFlexGrid1.DataSource = RS1
    y = 200: px = 0
    Set Preview = New PrintPreview5.Preview
    With Preview
    .AddFirstPage "0.25 in", "0.25 in", ".250 in", "0.50 in", "0.0 in", ".0 in", prPSLetter
    .PageSize = prPSLetter
    .PaperSize = prPSLetter
    .WindowState = prMaximized
    .CurrentFrame = "Inside"
    If Option1.Value = False Then
    .Orientation = prORLandscape
    Else
    .Orientation = prORPortrait
    End If
    .NewReport
    .ReportHeaders RS1 ' **** This is what doesn't work (because it doesn't show up as a property)

    Call .Authorize("Premium Software", pPreviewAuthorize)
    .Output = prOTScreen
    .PrintQuality = prPQMedium
    .Modal = True
    .EndDocument
    End With
    ' Label4.Caption = "Item Count = " & RS.RecordCount

    RS1.Close
    cn.Close
    On Error GoTo 0

    any advice would be appreciated

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: vb6 property missing from method

    Recordset could be an issue

    Code:
    Dim RS1 As Recordset
    Set RS1 = New Recordset
    VB6 has both a DAO recordset and an ADO recordset. Normally you would not have an issue dimming as you have done provided that you only have a reference to one of those libaries e.g. ADO or DAO. If however you have both then that could be a problem.

    I would suggest that you double check your rreferences to make sure that you do have the ADO in there [Microsoft Active X Data Objects]

    I would also suggest changing the lines above to
    Code:
    Dim RS1 As ADODB.Recordset
    Set RS1 = New ADODB.Recordset
    See if that solves the issue

    There may be other areas where you need to add that ADODB. part as well, like in the Sub Definition and where ever you are defining or setting a recordset object.
    Last edited by DataMiser; July 31st, 2013 at 02:10 AM.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jul 2013
    Posts
    4

    Re: vb6 property missing from method

    Thanks -- that is usually information about specifically defining the data connectors. I did it, but it didn't make any difference with my problem.

    My problem seems to be that the vb6 ide won't recognize the properties of one of the methods in my program (with the preview5.dll) -- all the dll's method's show up with the correct properties, except the RecordSetReport. I downloaded a copy of PE Explorer and tracked down this method -- the results are below:

    //Create a report from a recordset.
    function RecordsetReport(out oRecordset: ^^UserDefined; out Headers: ^Bool; out bWidths: ^Bool; out etsStep: ^eAutoStep); stdcall;


    so it's in the dll, but definition from the vb6 ide only shows:

    Sub RecordsetReport()
    Member of PrintPreview5.Preview
    Create a report from a recordset.

    whereas on my laptop it shows the correct properties (same dll, version of references/components, Windows7)

    Sub RecordsetReport(oRecordset As Recordset, [Headers As Boolean = False], [bWidths As Boolean = False], [etsStep As eAutoStep = 1])
    Member of PrintPreview5.Preview
    Create a report from a recordset.

    So I guess after all I've changed out, the question is how can the vb ide ignore the properties of a method?

    I should be able to insert the RecordsetReport into any of my subs that use the printpreview dll and the properties should show up.

    Also remember that I can run the same source across a network, and it works ok (so seems to be computer dependent)

    So I guess again, how can the vb ide ignore properties?

    Will look up the information to compile from command prompt and see if it will work that way

    Thanks for looking

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: vb6 property missing from method

    Well first of all it is not a property that you are talking about here. It is an argument to the sub/function in question.

    It sounds there is a problem with either the DLL, the registration of the DLL or the reference to it in VB.

    You say they are both running identical versions of Win 7. I assume this means that they are both 64bit or 32bit and not a combination of the two.

    When you registered the dll on the problem machine did you do so as admin?
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Jul 2013
    Posts
    4

    Re: vb6 property missing from method

    Quote Originally Posted by DataMiser View Post
    Well first of all it is not a property that you are talking about here. It is an argument to the sub/function in question.

    It sounds there is a problem with either the DLL, the registration of the DLL or the reference to it in VB.

    You say they are both running identical versions of Win 7. I assume this means that they are both 64bit or 32bit and not a combination of the two.

    When you registered the dll on the problem machine did you do so as admin?

    -- yes 64 bit -- yes registered as admin -- will have load another version of vb6 to try compile as command line

  6. #6
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: vb6 property missing from method

    Odd. I do not know what the issue would be then. I have never saw an issue like this and have been using VB6 almost daily for over 10 years now, I've had it on lots of different systems and other than making sure I get all the external files properly installed I have not ran into a problem aside from the initial install under Windows 8.

    Mostly I use VB6 under XP though. Either as the base OS on the system or in a VM running under the main OS. The nice thing about the Windows Virtual XP Mode is that once you configure it you can copy the VHD file to another machine and duplicate the environment without having to go through all of that install procedure.

    Have you considered using XPMode in this case?
    Always use [code][/code] tags when posting code.

  7. #7
    Join Date
    Jul 2013
    Posts
    4

    Re: vb6 property missing from method

    yes, I've been working with vb since vb6, this is a strange problem.
    I use VMware and can run virtual machines -- and it works ok on them -- but it is so handy to easily bounce between things -- but it does work in a virtual machine -- so if I can't find out what the problem is, I may have to resort to that.
    Thanks for you attention -- if I discover what the problem is -- I'll post here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured