Results 1 to 11 of 11

Thread: [RESOLVED] Arguments to a public sub

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Resolved [RESOLVED] Arguments to a public sub

    I have a lot of MshFlexgrids in different forms and am tired of setting the grid size to match it's rows. So I have decided to make a public sub in a bas module and just pass the grids name, but am missing something.
    maybe i'm getting brain dead, but i am having trouble getting this to work

    Public Sub SetGridSize(ByRef grd As MSHFlexGrid)
    With grd
    .Height = .Rows * .RowHeight(.Rows - 1)' use the height of the last row
    End With

    End Sub

    I am calling it like this: In form
    SetGridSize DocGrid

    but am getting a "wrong arguments or invalid property assignment" message
    what is wrong ?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Arguments to a public sub

    add a check to make sure that .Rows is >0 before trying to use it in the formula...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Arguments to a public sub

    Quote Originally Posted by techgnome
    add a check to make sure that .Rows is >0 before trying to use it in the formula...

    -tg
    I am calling it after i set the the number of rows.
    In this case:
    DocGrid.Rows = 6
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Arguments to a public sub

    so, what line does the error happen on?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Arguments to a public sub

    Quote Originally Posted by techgnome
    so, what line does the error happen on?

    -tg
    it happens right from the call:
    SetGridSize DocGrid
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Arguments to a public sub

    Have you tried stepping thru the code? Is DocGrid an MSHFlexGrid?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Arguments to a public sub

    Does the code work OK if this method is not in the module and rather in that form itself?
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  8. #8

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Arguments to a public sub

    Quote Originally Posted by dee-u
    Have you tried stepping thru the code? Is DocGrid an MSHFlexGrid?
    There is no stepping thru it. It happens at the call
    SetGridSize DocGrid
    I have also tried this: Call SetGridSize(DocGrid)
    same error
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  9. #9

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Arguments to a public sub

    I tried on another grid in the same project and the same error
    I tried on another project and it worked, I am stumped
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Arguments to a public sub

    You seem to have missed this question:
    Quote Originally Posted by dee-u
    Is DocGrid an MSHFlexGrid?
    Note that MSHFlexGrid is not the same as MSFlexGrid.


    You should also check if there are any other routines called SetGridSize, as it may actually be a different one which is being called.

  11. #11

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Arguments to a public sub

    Quote Originally Posted by si_the_geek
    You seem to have missed this question:

    Note that MSHFlexGrid is not the same as MSFlexGrid.


    You should also check if there are any other routines called SetGridSize, as it may actually be a different one which is being called.
    Just tried your suggestion, i thought a longshot, but
    There was another SetGridSize, that was being used by an ocx
    ActiveResize1_ResizeComplete. Thanks
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

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