Page 13 of 24 FirstFirst ... 31011121314151623 ... LastLast
Results 481 to 520 of 939

Thread: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

  1. #481
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Niya View Post
    That so called "bloat" you're talking about is the part that makes modern programming less of a chore than it would have been in the 90s.
    No, there's tools and languages out there, which make "programming less of a chore", whilst avoiding "bloat".

    Be brave - you can say the name of them Niya -
    keep trying, come on... press... now again, get it over your lips...
    ...again, ...yeah, nearly there..., "make that mental blockade your biatch"...

    Quote Originally Posted by Niya View Post
    If anyone today wants to avoid the "bloat", they can very easily on Windows, just build your program using pure Win32.
    Either that, or they can alternatively use thin COM-(Class-)wrapper-libs instead -
    along with OO-languages which make use of COM-libs and can produce COM-libs (C++, VB6, twinBasic).

    Olaf
    Last edited by Schmidt; Sep 8th, 2021 at 02:41 AM.

  2. #482
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    996

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    In the early 80's I was working as a programmer out of uni (OK - do the maths) with DEC PDP (RSTS/E), DECSYSTEM-20 (TOPS-20) and Pick systems. Great all of them - but my favourite was (and still is!) Pick.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #483
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Pick was an amazing operating system *** database that was advanced for its day. A lot of what it did carried over to other later o/s.
    The file system for VMS was record-orientated so that it contained one of the elements of a built in database. It was easy to build database apps when every open record in every file on the o/s could be identified cluster-wide.

    [forum censored my word C U M - which means 'with' in Latin, a word still in general use in the English language as spoken by an Englishman]
    Last edited by yereverluvinuncleber; Sep 8th, 2021 at 06:47 AM.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  4. #484
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by yereverluvinuncleber View Post
    The file system for VMS was record-orientated so that it contained one of the elements of a built in database. It was easy to build database apps when every open record in every file on the o/s could be identified cluster-wide.
    Unless you've worked a VAX understanding how the file system and RMS (record management services) danced so effortlessly would be so foreign. People in the PC world right-click and create .TXT files. On a VAX, you created ISAM files with the same ease! And could tune them right from the command line - so nice! https://en.wikipedia.org/wiki/Record...ement_Services

    I recall DEC and MS had an initiative that would somehow work SQL into the DOS / NT file system. Unfortunately that never saw the light of day.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #485
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    This thread is now a better thread than it was, so much more positive, so much more relaxed and Digital.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  6. #486
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    I really do miss version numbers on files.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  7. #487
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    996

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by szlamany View Post
    Unless you've worked a VAX understanding how the file system and RMS (record management services) danced so effortlessly would be so foreign. People in the PC world right-click and create .TXT files. On a VAX, you created ISAM files with the same ease! And could tune them right from the command line - so nice! https://en.wikipedia.org/wiki/Record...ement_Services

    I recall DEC and MS had an initiative that would somehow work SQL into the DOS / NT file system. Unfortunately that never saw the light of day.
    Dave Cutler - who was a major force behind VMS - went to MS to lead the development of Windows NT. Under the hood, there's a lot of similarity between the VMS fs and NT fs. At the time I recall that there was a lot more planned for the NT fs than ever saw the light of day. Pity. MS put the resources into AD and the GUI front end. There was (is?) support for posix and os/2. Direct support for some data-base like functionality was planned/some development done but was never realised. Cairo was supposed to have an object file system (winfs) - but development was canned in 2006.

    The last I know Cutler was working on MS Xbox.

    Shame about Cairo/winfs.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  8. #488
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    996

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    For those hankering after the old great DEC os's - there's various hardware simulations available that run the actual OS code kindly provided.

    See:
    http://simh.trailing-edge.com/
    http://simh.trailing-edge.com/software.html

    There's also a complete working HP TSB system - with full A000 library programs!

    Pity there's no Pick simulation (that I know of)...
    Last edited by 2kaud; Sep 8th, 2021 at 07:45 AM.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  9. #489
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    More VAX...

    This is a DIR/FU/SECURITY on an ISAM file.

    @yer - there is your version number, ";1" trailing the file extension.

    This security was powerful and easy to use: File protection: System:RWED, Owner:RWED, Group:RWED, World:E

    Code:
    VEHICLE.DBS;1                 File ID:  (94948,1,0)
    Size:            9/9          Owner:    [40,2]
    Created:    13-AUG-1991 22:46:56.47
    Revised:     7-NOV-1995 14:09:33.78 (5)
    Expires:    <None specified>
    Backup:      7-SEP-2021 17:42:00.71
    Effective:  <None specified>
    Recording:  <None specified>
    Accessed:   <None specified>
    Attributes: <None specified>
    Modified:   <None specified>
    Linkcount:  1
    File organization:  Indexed, Prolog: 3, Using 3 keys
    Shelved state:      Online
    Caching attribute:  Writethrough
    File attributes:    Allocation: 45, Extend: 0, Maximum bucket size: 2, Global bu
    ffer count: 0
                        Version limit: 3
    Record format:      Variable length, maximum 225 bytes, longest 0 bytes
    Record attributes:  Carriage return carriage control
    RMS attributes:     None
    Journaling enabled: None
    File protection:    System:RWED, Owner:RWED, Group:RWED, World:E
    Access Cntrl List:  None
    Client attributes:  None
    And of course you could TYPE out the contents of an ISAM file - it was shown nicely!

    Code:
    $ ty ledger.dbs
        20000168710129102000P0100000007013578636500000000293000       000227IN199908
    273145      AB CHANCE 6502 5/8STD EYENUT      000779   S       S000993P00266486.
    28                     86.28
    $

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  10. #490
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    And a deep dive into the ISAM attributes of that LEDGER.DBS file.

    You have to realize this was a type of FILE that the O/S and file system understood. This was created with an OPEN statement in BASIC!!

    Each attribute accessible through the syntax of the OPEN statement.

    On a PC you have TEXT files and BINARY files, I guess...and the FILE EXTENTION drives you to an APPLICATION that manages that file type. That approach is so not the only way to achieved file access.

    Code:
    $ analyze/rms ledger.dbs/output=t.txt
    %ANLRMS-I-ERRORS, <DKA2:[ANTARES.HOME]LEDGER.DBS;1> 0 errors
    $
    $
    $ type/page t.txt
     
    Check RMS File Integrity                      8-SEP-2021 08:38:06.05   Page 1
    DKA2:[ANTARES.HOME]LEDGER.DBS;1
    
    
    FILE HEADER
    
            File Spec: DKA2:[ANTARES.HOME]LEDGER.DBS;1
            File ID: (91493,2,0)
            Owner UIC: [40,2]
            Protection:  System: RWED, Owner: RWED, Group: RWED, World: E
            Creation Date:   31-AUG-1999 13:42:26.55
            Revision Date:   31-AUG-1999 13:44:00.48, Number: 3
            Expiration Date: none specified
            Backup Date:      7-SEP-2021 17:42:00.71
            Contiguity Options:  none
            Performance Options: none
            Reliability Options: none
            Journaling Enabled:  none
    
    
    RMS FILE ATTRIBUTES
    Press RETURN to continue
    
    
            File Organization: indexed
            Record Format: variable
            Record Attributes:  carriage-return
            Maximum Record Size: 225
            Blocks Allocated: 45, Default Extend Size: 0
            Bucket Size: 2
            File Monitoring: disabled
            Global Buffer Count  pre-V8.3:          0
            Global Buffer Count post-V8.3:          0
            Global Buffer Flags post-V8.3:       none
    
    
    FIXED PROLOG
    
            Number of Areas: 1, VBN of First Descriptor: 4
            Prolog Version: 3
    
    AREA DESCRIPTOR #0 (VBN 4, offset %X'0000')
    
            Bucket Size: 2
    Press RETURN to continue
    
            Reclaimed Bucket VBN: 0
            Current Extent Start: 37, Blocks: 9, Used: 4, Next: 41
            Default Extend Quantity: 0
            Total Allocation: 45
    
    KEY DESCRIPTOR #0 (VBN 1, offset %X'0000')
    
            Next Key Descriptor VBN: 2, Offset: %X'0000'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 7
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
     
    Check RMS File Integrity                      8-SEP-2021 08:38:06.06   Page 2
    DKA2:[ANTARES.HOME]LEDGER.DBS;1
    
    
    Press RETURN to continue
    
                    (6)  KEY$V_KEY_COMPR  1
                    (7)  KEY$V_REC_COMPR  1
            Key Segments: 1
            Key Size: 10
            Minimum Record Size: 14
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4
            Segment Sizes:          10
            Data Type: string
            Name: ""
            First Data Bucket VBN: 5
    
    KEY DESCRIPTOR #1 (VBN 2, offset %X'0000')
    
            Next Key Descriptor VBN: 2, Offset: %X'0066'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 12
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
    Press RETURN to continue
    
                    (1)  KEY$V_CHGKEYS    1
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 3
            Key Size: 16
            Minimum Record Size: 59
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4    53     8
            Segment Sizes:           4     6     6
            Data Type: string
            Name: ""
            First Data Bucket VBN: 10
    
    KEY DESCRIPTOR #2 (VBN 2, offset %X'0066')
    
            Next Key Descriptor VBN: 2, Offset: %X'00CC'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
    Press RETURN to continue
    
            Root VBN: 16
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
                    (1)  KEY$V_CHGKEYS    1
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 4
            Key Size: 26
            Minimum Record Size: 92
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
     
    Check RMS File Integrity                      8-SEP-2021 08:38:06.06   Page 3
    DKA2:[ANTARES.HOME]LEDGER.DBS;1
    
    
            Segment Positions:       4    66    82     8
            Segment Sizes:           4     6    10     6
            Data Type: string
            Name: ""
    Press RETURN to continue
    
            First Data Bucket VBN: 14
    
    KEY DESCRIPTOR #3 (VBN 2, offset %X'00CC')
    
            Next Key Descriptor VBN: 2, Offset: %X'0132'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 21
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
                    (1)  KEY$V_CHGKEYS    1
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 3
            Key Size: 17
            Minimum Record Size: 143
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4   136     8
    Press RETURN to continue
    
            Segment Sizes:           4     7     6
            Data Type: string
            Name: ""
            First Data Bucket VBN: 19
    
    KEY DESCRIPTOR #4 (VBN 2, offset %X'0132')
    
            Next Key Descriptor VBN: 2, Offset: %X'0198'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 25
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
                    (1)  KEY$V_CHGKEYS    1
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 3
            Key Size: 16
    Press RETURN to continue
    
            Minimum Record Size: 132
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4   126     8
            Segment Sizes:           4     6     6
            Data Type: string
            Name: ""
            First Data Bucket VBN: 23
    
     
    Check RMS File Integrity                      8-SEP-2021 08:38:06.06   Page 4
    DKA2:[ANTARES.HOME]LEDGER.DBS;1
    
    
    KEY DESCRIPTOR #5 (VBN 2, offset %X'0198')
    
            Next Key Descriptor VBN: 3, Offset: %X'0000'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 30
            Key Flags:
    Press RETURN to continue
                    (0)  KEY$V_DUPKEYS    0
                    (1)  KEY$V_CHGKEYS    1
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 3
            Key Size: 20
            Minimum Record Size: 92
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4    82     8
            Segment Sizes:           4    10     6
            Data Type: string
            Name: ""
            First Data Bucket VBN: 28
    
    KEY DESCRIPTOR #6 (VBN 3, offset %X'0000')
    
            Next Key Descriptor VBN: 3, Offset: %X'0066'
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
    Press RETURN to continue
    
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 34
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
                    (1)  KEY$V_CHGKEYS    1
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 3
            Key Size: 16
            Minimum Record Size: 150
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4   144     8
            Segment Sizes:           4     6     6
            Data Type: string
            Name: ""
            First Data Bucket VBN: 32
    
    KEY DESCRIPTOR #7 (VBN 3, offset %X'0066')
    
    Press RETURN to continue
    
            Index Area: 0, Level 1 Index Area: 0, Data Area: 0
            Root Level: 1
            Index Bucket Size: 2, Data Bucket Size: 2
            Root VBN: 39
     
    Check RMS File Integrity                      8-SEP-2021 08:38:06.06   Page 5
    DKA2:[ANTARES.HOME]LEDGER.DBS;1
    
    
            Key Flags:
                    (0)  KEY$V_DUPKEYS    0
                    (1)  KEY$V_CHGKEYS    0
                    (2)  KEY$V_NULKEYS    0
                    (3)  KEY$V_IDX_COMPR  1
                    (4)  KEY$V_INITIDX    0
                    (6)  KEY$V_KEY_COMPR  1
            Key Segments: 3
            Key Size: 55
            Minimum Record Size: 59
            Index Fill Quantity: 1024, Data Fill Quantity: 1024
            Segment Positions:       4    14     8
    Press RETURN to continue
            Segment Sizes:           4    45     6
            Data Type: string
            Name: ""
            First Data Bucket VBN: 37
    
    
    The analysis uncovered NO errors.
    
    
    ANALYZE/RMS LEDGER.DBS/OUTPUT=T.TXT
    $

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  11. #491
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    996

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    @szlamany - Don't! No more please! You're making me feel nostalgic and really, really longing for the past! Apart from Pick, IMO DEC had the best os's around in the 1980's - 1990's. Ah, those were the good old days...
    Last edited by 2kaud; Sep 8th, 2021 at 08:34 AM.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  12. #492
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    @2kaud - it amazes me that I actually remembered the ANA/RMS command - it just comes back naturally - the human brain functions really well still!

    I have the good fortune of an upcoming project with VAX data. I recently launched a "legacy data" website and my first client is having me archive MS SQL data (got that working nicely), but also ACCESS data and soon this VAX data. The website runs a lookup query and a verify query to make a filter and then select rows based on that filter.

    I store the lookup and verify queries in a lookup table in SQL. Check out that first VERIFY query - it's returning JSON that contains HTML! Talk about a cross-platform/cross-discipline mixup!

    Here we are in a thread about XYZ-superiority leaving all things past in the dust. Screw that!

    Code:
    TableName			FieldName	LUType	SeqNo	QueryText
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Lookup	1	Select MA.MasName+' ('+Cast(MI.MasId as varchar(100))+' / '+MA.SSN+')' "Payee",MI.MasId
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Lookup	2	 From (Select Distinct PC.MasId From [~~servername~~].[Acctfiles].[dbo].[PayCheck_T] PC) MI
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Lookup	3	 Left Join [~~servername~~].[Acctfiles].[dbo].[Master_T] MA on MA.MasId=MI.MasId
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Lookup	4	 Where MA.MasName is not null
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Lookup	5	 Order by 1
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	1	Select '["lookupverify", "<br />Payee: ' + MA.MasName + ' (' + Cast(MA.MasId as varchar(100))+')'
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	2	   + '<br /><br />Phone: ' + IsNull(AD.AddrPhone,'')
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	3	   + '<br />EMail: ' + IsNull(MA.EMail,'')
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	4	   + '<br /><br />Address: ' + IsNull(AD.AddrLot,'') + ' ' + IsNull(AD.AddrStreet,'') + ', ' + IsNull(AD.AddrCity,'') + ' ' + IsNull(AD.AddrState,'') + ' ' + IsNull(AD.AddrZip,'')+'"]'
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	5	 From [~~servername~~].[Acctfiles].[dbo].[Master_T] MA
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	6	 Left Join [~~servername~~].[Acctfiles].[dbo].[Addr_T] AD on AD.MasId=MA.MasId and AD.AddrTag=MA.AddrTag
    Acctfiles.dbo.ACS_PayEmpDisplay_T	MasId	Verify	7	 Where MA.MasId=@RowKey 
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Lookup	1	Select BP.LUAddress, BP.LUAddress From [~~servername~~].[Building].[dbo].[ACS_bldg_Permit_V] BP Where BP.LUAddress<>''
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Lookup	2	 Group by BP.LUAddress,IsNull(BP.BPT_Street_Name_VC,''),Case When IsNumeric(BP.BPT_Street_NO_VC)=1 Then Cast(BP.BPT_Street_NO_VC as bigint) Else 0 End
    
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Lookup	3	 Order by IsNull(BP.BPT_Street_Name_VC,''), Case When IsNumeric(BP.BPT_Street_NO_VC)=1 Then Cast(BP.BPT_Street_NO_VC as bigint) Else 0 End
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Verify	1	Select Top 1 '["lookupverify", "<br />Lookup Address: ' + BP.LUAddress
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Verify	2	 +'<br />Latest Permit No and Date: ' + Cast(BP.BPT_Permit_NM as varchar(100)) + ' ' + Convert(varchar(10),BP.BPT_Permit_Dt,101)
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Verify	3	 +'"]'
    Building.dbo.ACS_bldg_Permit_V	LUAddress	Verify	4	From [~~servername~~].[Building].[dbo].[ACS_bldg_Permit_V] BP Where BP.LUAddress=@RowKey Order by BP.BPT_Permit_Dt Desc

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  13. #493
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    I can still edit using the EDT editor keypad with my eyes closed.

    I have a 32 bit Windows binary of the EDT editor, if you want a copy...
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  14. #494
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by yereverluvinuncleber View Post
    I can still edit using the EDT editor keypad with my eyes closed.

    I have a 32 bit Windows binary of the EDT editor, if you want a copy...
    Yes - me as well!

    I would definitely take a copy of a Windows version of EDT!

    Check out this EDT.INI file and this .COM file for running EDT with the TPU switch (https://en.wikipedia.org/wiki/EDT_(Digital))

    Code:
    $ ty/page edtini.edt
    SET SEARCH END
    DEF KEY 10 AS "ADVEL-C-CD+C."
    DEF KEY CONTROL G AS "7ASC."
    DEF KEY GOLD 14 AS "SHR."
    DEF KEY GOLD 15 AS "SHL."
    SET ENTITY WORD "
             ;,<>/*-+=()'"
    !
    ! The following keys have been defined:
    !
    !       GOLD E  --      quick exit to DCL
    !
    !       GOLD M  --      inserts file marker (~~/\~~)
    !
    !       GOLD C  --      copies range to range (range to buffer...etc.)
    !
    !       GOLD F  --      finds file marker and deletes it
    !
    !       GOLD B  --      prompts for a buffer and puts you there
    !
    !       GOLD L  --      puts you at current line in last visited buffer
    !
    !       GOLD W  --      prompts for a filename and a range to write
    !
    !       GOLD R  --      Reads a file into specified range or current line
    !
    !       GOLD S  --      Shows all existing buffers and current buffer
    !
    !       arrows  --      Up-arrow finds top of file; down-arrow finds bottom
    !
    define key gold e as "extexit."
    define key gold m as "i~~/\~~ ."
    define key gold f as "bradv'~~/\~~'6(d-c)."
    define key gold 12 as "br."
    define key gold 13 as "er."
    define key gold c as "ext copy ?'From: ' to ?' To: '."
    define key gold b as "ext find ?'Buffer: '."
    define key gold l as "ext find last."
    define key gold s as "ext show buffer."
    define key gold r as "ext include ?'File: ' ?' To: '."
    define key gold w as "ext write ?'File: ' ?' Range: '."
    set command sys$login:edtini.edt
    $
    And this replaced the EDT command...
    Code:
    $ ty/page edtmemory.com
    $       save_verify     = 'f$verify(0)
    $       ! ACS$UTL:EDTMEMORY.COM
    $       null            = ""
    $       edittype        = f$logical("mail$edit")
    $       termtype        = f$logical("sys$termtype")
    $       permvt200       = "''sys11_permvt200
    $       vt200_series    = f$locate("VT2",termtype) .ne. f$len(termtype)
    $       pro_series      = f$locate("PRO",termtype) .ne. f$len(termtype)
    $       !if .not. (vt200_series .or. pro_series) then $ edittype = ""
    $       if .not. (vt200_series .or. pro_series) then $ goto no_vt200_series
    $       vt200on         := "
    t200off        := "
    t200_delm      := "p"
    $       write sys$output "Setting terminal for VT200_Series editing",vt200on,vt2
    00_delm
    $no_vt200_series:
    $       gigi            = 0
    $       if termtype .eqs. "VK100" then $ gigi = 1
    $       edtini_file     = "ACS$UTL:edtini.edt"
    $       edit_qual       = "/EDT/COMMAND=" + edtini_file
    $       if edittype .eqs. "CALLABLE_TPU"
    $               then edit_qual = "/TPU"
    
    $               set prompt="Edit_$ "
    $       endif
    $       if p1 .nes. null then $ goto p1eval
    $       if edt_memory .eqs. null then $ goto get_file
    $       write sys$output "''F$FAO("Editing file !AS",edt_memory)
    $got_file:
    $       edt_command := "editxxx"'edit_qual'" "'edt_memory'
    $edt:
    $       if gigi then $ goto setup_gigi
    $call_edt:
    $       set nocontrol=t
    $       set control=y
    $       set term/noesc
    $       define/user sys$input 'f$logical("sys$command")
    $ !     if edittype .eqs. "CALLABLE_TPU" then -
    $ !             define/user librtl sys$share:librtl$v44
    $       'edt_command'
    $edt_end:
    $       if edittype .eqs. "CALLABLE_TPU" then $ set prompt="$ "
    $       set control=(y,t)
    $       if gigi .eq. 0 then $ goto done
    
    $       write sys$output "Resetting the GIGI"
    $       write sys$output ""
    $       goto done
    $p1eval:
    $       nomem = 'f$locate("/NOMEM",P1)'
    $       if nomem .eq. 'f$length(p1)' then $ goto p1_step_2
    $       nomem = nomem
    $       p1 := 'f$extract(0,nomem,p1)'
    $       filespec := 'p1'
    $        goto nomem_start
    $p1_step_2:
    $       filespec := 'p1'
    $p1eval_end:
    $       edt_memory :== 'filespec'
    $nomem_start:
    $        edt_command := "editxxx'edit_qual''sec_qual' "'filespec'
    $        goto edt
    $synerr:
    $       write sys$output "?? Syntax error"
    $       goto done
    $get_file:
    $p1eval_end:
    $       edt_memory :== 'filespec'
    $nomem_start:
    $        edt_command := "editxxx'edit_qual''sec_qual' "'filespec'
    $        goto edt
    $synerr:
    $       write sys$output "?? Syntax error"
    $       goto done
    $get_file:
    Press RETURN to continue
    
    $       inq/nopun/glo edt_memory "File: "
    $ goto got_file
    $done:
    $       if .not. (vt200_series .or. pro_series) then $ goto no_vt200_reset
    $       if permvt200 then $ goto no_vt200_reset
    $       write sys$output "Resetting terminal from VT200_Series editing"-
    ,vt200off,vt200_delm
    $no_vt200_reset:
    $        if save_verify then $ set verify
    $       exit
    $setup_gigi:
    $       write sys$output "Setting up the GIGI"
    $       write sys$output ""
    $       write sys$output ""
    $       write sys$output ""
    $       set nocontrol_y
    $       goto call_edt
    $
    Ever play with a GIGI?

    https://randoc.wordpress.com/2018/04...ec-vk100-gigi/

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  15. #495
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Don't turn me on with your lexicals...
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  16. #496
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by yereverluvinuncleber View Post
    Don't turn me on with your lexicals...
    Lol!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  17. #497

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Schmidt View Post
    Be brave - you can say the name of them Niya -
    keep trying, come on... press... now again, get it over your lips...
    ...again, ...yeah, nearly there..., "make that mental blockade your biatch"...
    lol you're a funny guy

    But seriously:-
    Quote Originally Posted by Schmidt View Post
    No, there's tools and languages out there, which make "programming less of a chore", whilst avoiding "bloat".
    Here is yet another example of what I'm talking about I came across fairly recently, calling function pointers:-

    VB.Net
    Code:
    Imports System.ComponentModel
    Imports System.Runtime.InteropServices
    
    Public Class EntryPoint
    
        Private Delegate Function AsmAdd(ByVal a As Integer, ByVal b As Integer) As Integer
    
        <DllImport("kernel32", CharSet:=CharSet.Auto, SetLastError:=True)>
        Private Shared Function VirtualProtectEx(ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal flNewProtect As UInteger, ByRef lpflOldProtect As UInteger) As Boolean
        End Function
    
    
        <DllImport("kernel32", CharSet:=CharSet.Auto, SetLastError:=True)>
        Private Shared Function FlushInstructionCache(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal dwSize As Integer) As Boolean
        End Function
    
        Private Const EXECUTE_READWRIT As Integer = &H40
    
        Public Shared Sub Main()
    
            'Get the machine code x86 instructions for function
            Dim prog As Byte() = GetAsmProc()
    
            'Get handle to the memory containing machine code
            Dim arrayHandle As GCHandle = GCHandle.Alloc(prog, GCHandleType.Pinned)
            Dim n As UInteger
    
            'Make the memory containing the machine code executable memory
            If Not VirtualProtectEx(Process.GetCurrentProcess.Handle, arrayHandle.AddrOfPinnedObject, prog.Length, EXECUTE_READWRIT, n) Then
                Throw New Win32Exception()
            End If
    
            'Flush the instructio cache
            If Not FlushInstructionCache(Process.GetCurrentProcess.Handle, arrayHandle.AddrOfPinnedObject, prog.Length) Then
                Throw New Win32Exception()
            End If
    
            'Obtain a .Net delegate reference to the machine code function
            Dim addFunc As AsmAdd = Marshal.GetDelegateForFunctionPointer(arrayHandle.AddrOfPinnedObject, GetType(AsmAdd))
    
            'Execute the function
            MessageBox.Show(addFunc.Invoke(4, 7).ToString)
    
            arrayHandle.Free()
    
        End Sub
    
        Private Shared Function GetAsmProc() As Byte()
            '*****************************************************************************************************
            '; VB.Net function signature
            '; Function AddInt32(ByVal a As Integer, ByVal b As Integer) As Integer
            ';-----------------------------------------------------------------------------------
    
            'use32
    
            'push ebp                            
            'mov ebp, esp                        
    
            'mov eax, [ebp + 8]					
            'add eax, [ebp + 12]					
    
            'mov esp, ebp
            'pop ebp
    
            'ret 8                               
            '*****************************************************************************************************
            Dim mc As Byte() = New Byte(14) {}
    
            mc(0) = 85
            mc(1) = 137
            mc(2) = 229
            mc(3) = 139
            mc(4) = 69
            mc(5) = 8
            mc(6) = 3
            mc(7) = 69
            mc(8) = 12
            mc(9) = 137
            mc(10) = 236
            mc(11) = 93
            mc(12) = 194
            mc(13) = 8
            mc(14) = 0
    
            Return mc
    
        End Function
    
    End Class
    The above code takes an array that contains some native x86 code and executes it. The native code is just a function I wrote in assembly to add two numbers. Calling that function from VB.Net was very easy and straightforward. Now let's look at the VB6 version of that program:-

    VB6

    Code:
    Option Explicit
    
    Private Declare Function GetMem4 Lib "msvbvm60" (src As Any, dst As Any) As Long
    Private Declare Function VirtualProtect Lib "kernel32" (ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
    Private Declare Sub EbGetExecutingProj Lib "vba6" (hProject As Long)
    Private Declare Function TipGetFunctionId Lib "vba6" (ByVal hProj As Long, ByVal bstrName As Long, ByRef bstrId As Long) As Long
    Private Declare Function TipGetLpfnOfFunctionId Lib "vba6" (ByVal hProject As Long, ByVal bstrId As Long, ByRef lpAddress As Long) As Long
    Private Declare Sub SysFreeString Lib "oleaut32" (ByVal lpbstr As Long)
       
    Private Declare Function VirtualProtectEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, ByRef lpflOldProtect As Long) As Long
    Private Declare Function FlushInstructionCache Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal dwSize As Long) As Long
    
    Private Const PAGE_EXECUTE_READWRITE As Integer = &H40
    
    Public Sub Main()
        
        
        Dim prog() As Byte
        Dim n As Long
        Dim ans As Long
        
        'Get the machine code x86 instructions for function
        prog = GetAsmProc
        
        'Make the memory containing the machine code executable memory
        If Not CBool(VirtualProtectEx(-1, VarPtr(prog(LBound(prog))), (UBound(prog) - LBound(prog)) + 1, PAGE_EXECUTE_READWRITE, n)) Then
            Err.Raise 11000, , "VirtualProtectEx Failed"
        End If
    
        'Flush the instructio cache
        If Not CBool(FlushInstructionCache(-1, VarPtr(prog(LBound(prog))), (UBound(prog) - LBound(prog)) + 1)) Then
            Err.Raise 11001, , "Failed to flush instruction cache"
        End If
        
        'No clue what this does or how it works. I just blindly followed what
        'I saw in thetrick's example
        PatchFunc "AsmAdd", AddressOf AsmAdd
        
        'This crashes the IDE.
        'This should work according to how it's used in thetrick's example
        'but for some reason it fails here. All I want to do is call a goddamn function
        'from it's pointer! I really don't have half a day to devote to just figuring out
        'why this is not working. This is EXACTLY the kind of bullshit I can no longer
        'tolerate with VB6. This is very straightfoward to do in .Net.
        ans = AsmAdd(VarPtr(LBound(prog)), 4, 7)
        
    End Sub
    
    Private Function GetAsmProc() As Byte()
        '*****************************************************************************************************
        '; VB.Net function signature
        '; Function AddInt32(ByVal a As Integer, ByVal b As Integer) As Integer
        ';-----------------------------------------------------------------------------------
    
        'use32
    
        'push ebp
        'mov ebp, esp
    
        'mov eax, [ebp + 8]
        'add eax, [ebp + 12]
    
        'mov esp, ebp
        'pop ebp
    
        'ret 8
        '*****************************************************************************************************
        Dim mc(0 To 14) As Byte
    
        mc(0) = 85
        mc(1) = 137
        mc(2) = 229
        mc(3) = 139
        mc(4) = 69
        mc(5) = 8
        mc(6) = 3
        mc(7) = 69
        mc(8) = 12
        mc(9) = 137
        mc(10) = 236
        mc(11) = 93
        mc(12) = 194
        mc(13) = 8
        mc(14) = 0
    
        GetAsmProc = mc
    End Function
    
    Private Function AsmAdd(ByVal addr As Long, ByVal a As Long, ByVal b As Long) As Long
    End Function
    
    ' Âñïîìîãàòåëüíûå ôóíêöèè
    Public Sub PatchFunc(FuncName As String, ByVal addr As Long)
        Dim lpAddr As Long, hProj As Long, sId As Long, InIDE As Boolean
     
        Debug.Assert MakeTrue(InIDE)
     
        ' Ïîëó÷àåì àäðåñ ôóíêöèè
        If InIDE Then
            EbGetExecutingProj hProj
            TipGetFunctionId hProj, StrPtr(FuncName), sId
            TipGetLpfnOfFunctionId hProj, sId, lpAddr
            SysFreeString sId
        Else
            lpAddr = GetAddr(addr)
            VirtualProtect lpAddr, 8, PAGE_EXECUTE_READWRITE, 0
        End If
     
        ' Çàïèñûâàåì âñòàâêó
        ' Çàïóñêàòü òîëüêî ïî Ctrl+F5!!
        ' pop eax
        ' pop ecx
        ' push eax
        ' jmp ecx
     
        GetMem4 &HFF505958, ByVal lpAddr
        GetMem4 &HE1, ByVal lpAddr + 4
    End Sub
     
    Private Function GetAddr(ByVal addr As Long) As Long
        GetAddr = addr
    End Function
    Public Function MakeTrue(ByRef bvar As Boolean) As Boolean
        bvar = True: MakeTrue = True
    End Function
    Not only is the VB6 version far more complicated, I couldn't even get the damn thing to work because I have no clue what all that extra wizardry is supposed to do. Now here's the thing. It is perfectly within my power to figure out what thetrick's wizardry is all about here and fix it. But how long is that going to take? I don't know. Maybe I can crack in a couple hours. Or perhaps it would take me down a deep rabbit hole for a week. That is a chore!!! However, in .Net, I don't have to do that. The wizards at Microsoft did all that work for me and put that into the Framework.

    You guys want to talk about bloat? My time is more valuable than hard drive space, which by the way, we have an excess of in 2021. All this extra wizardry costs time which is a resource I cannot get back. This little side project has reinforced my feelings about this whole VB6/.Net thing. You have to be out of damn mind if you think VB6 is better. So I have to be some kind of super wizard genius just to figure out how to call a function pointer? lol come on man. That's just wasting time that could better spent actually writing the program!

    Also, couple of annoyances. Look at the difference in the code to get the size of an array. In VB6 it requires a bunch of math with LBound and UBound but in .Net, you just call the Length property. Then we have the code for getting the process handle. I was already quite annoyed at all the extra effort require for the VB6 version so I just put -1 as the process handle which is not proper. Such code could potentially break in the future and is not advised by Microsoft. However, you have access to the Process class in .Net which is readily available to be used. No need to go through the trouble of defining yet another Win32 import.

    One more thing. Before anyone shows up with some simple way of calling a function pointer to try and prove some kind of point to me, know this. That method I used in VB6 is what showed up when I asked Google how to call a function pointer from VB6. Even if one of you does know of a simpler way, the point still stands. It takes time. It wouldn't take very long for Google to eventually lead someone trying to do this in .Net to the Marshal class, which is backed by official Microsoft documentation with all the information needed to call a function pointer. None of this wild west cowboy code that could take you hours trawling through the depths of multiple forums to find and then more hours to try and understand.

    All of these extra chores just to save a few megabytes? You must be out of your mind if you think this is in any way, better. Absolutely insane!
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  18. #498
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by szlamany View Post
    Check out this EDT.INI file and this .COM file for running EDT with the TPU switch
    That DCL is so cosy and familiar, BASIC-like and is akin to welcome doormat on coming home. I could code in DCL using EDT and feel happy. There are commercial tools that will replicated the VMS environment on Windows from the perspective of the command line, lexical functions and suchlike. I have all the simulators of course as that was my job just before my current disaster.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  19. #499

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Here is another example of the scenario I mentioned in post #497. He wants to make a console application. That is such a simple request yet look at where the answer is, buried in bowels of some Russian forum. Look at the direction of that thread, talks of secret leaks, decompilation and links to obscure documents. Why would anyone opt to punish themselves like this? Come on, how is this better than what we have today? You think any .Net programmer has to go through all this James Bond stuff to figure out how to create a console application? Let's get real folks. No one in the right mind would think that all this trouble is worth saving a few megabytes that no one would even notice anyway.

    Also, I did some research of my own on this and the answers I found weren't any better. Mountains of code, utilities to hack EXEs, all kinds of madness. If one just uses .Net they could accomplish this is in mere seconds! A lot of people already did all of this work for you. Why re-invent the wheel?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  20. #500
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Niya View Post
    Here is yet another example of what I'm talking about I came across fairly recently, calling function pointers:-

    VB.Net
    Code:
    Imports System.ComponentModel
    Imports System.Runtime.InteropServices
    
    Public Class EntryPoint
    
        Private Delegate Function AsmAdd(ByVal a As Integer, ByVal b As Integer) As Integer
    
        <DllImport("kernel32", CharSet:=CharSet.Auto, SetLastError:=True)>
        Private Shared Function VirtualProtectEx(ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal flNewProtect As UInteger, ByRef lpflOldProtect As UInteger) As Boolean
        End Function
    
    
        <DllImport("kernel32", CharSet:=CharSet.Auto, SetLastError:=True)>
        Private Shared Function FlushInstructionCache(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal dwSize As Integer) As Boolean
        End Function
    
        Private Const EXECUTE_READWRIT As Integer = &H40
    
        Public Shared Sub Main()
    
            'Get the machine code x86 instructions for function
            Dim prog As Byte() = GetAsmProc()
    
            'Get handle to the memory containing machine code
            Dim arrayHandle As GCHandle = GCHandle.Alloc(prog, GCHandleType.Pinned)
            Dim n As UInteger
    
            'Make the memory containing the machine code executable memory
            If Not VirtualProtectEx(Process.GetCurrentProcess.Handle, arrayHandle.AddrOfPinnedObject, prog.Length, EXECUTE_READWRIT, n) Then
                Throw New Win32Exception()
            End If
    
            'Flush the instructio cache
            If Not FlushInstructionCache(Process.GetCurrentProcess.Handle, arrayHandle.AddrOfPinnedObject, prog.Length) Then
                Throw New Win32Exception()
            End If
    
            'Obtain a .Net delegate reference to the machine code function
            Dim addFunc As AsmAdd = Marshal.GetDelegateForFunctionPointer(arrayHandle.AddrOfPinnedObject, GetType(AsmAdd))
    
            'Execute the function
            MessageBox.Show(addFunc.Invoke(4, 7).ToString)
    
            arrayHandle.Free()
    
        End Sub
    
        Private Shared Function GetAsmProc() As Byte()
            '*****************************************************************************************************
            '; VB.Net function signature
            '; Function AddInt32(ByVal a As Integer, ByVal b As Integer) As Integer
            ';-----------------------------------------------------------------------------------
    
            'use32
    
            'push ebp                            
            'mov ebp, esp                        
    
            'mov eax, [ebp + 8]                    
            'add eax, [ebp + 12]                    
    
            'mov esp, ebp
            'pop ebp
    
            'ret 8                               
            '*****************************************************************************************************
            Dim mc As Byte() = New Byte(14) {}
    
            mc(0) = 85
            mc(1) = 137
            mc(2) = 229
            mc(3) = 139
            mc(4) = 69
            mc(5) = 8
            mc(6) = 3
            mc(7) = 69
            mc(8) = 12
            mc(9) = 137
            mc(10) = 236
            mc(11) = 93
            mc(12) = 194
            mc(13) = 8
            mc(14) = 0
    
            Return mc
    
        End Function
    
    End Class
    The above code takes an array that contains some native x86 code and executes it.
    ...
    Not only is the VB6 version far more complicated...
    It's not that "VB6-code is far more complicated" - it's just you (not knowing how to do it properly).

    For comparison (using an RC5 or RC6-Project-Reference):
    Code:
    Option Explicit
    
    Private Declare Function VirtualProtectEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, ByRef lpflOldProtect As Long) As Long
    Private Declare Function FlushInstructionCache Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal dwSize As Long) As Long
    
    Public Sub Main()
       MsgBox AsmAdd(4, 7)
    End Sub
    
    Public Function AsmAdd(ByVal a As Long, ByVal b As Long) As Long
      Static pF&: If pF = 0 Then pF = InitAsmAddFunc
      AsmAdd = New_c.stdCall(retLong, pF, a, b)
    End Function
    
    Private Function InitAsmAddFunc() As Long
     Static asm(0 To 14) As Byte
            asm(0) = 85
            asm(1) = 137
            asm(2) = 229
            asm(3) = 139
            asm(4) = 69
            asm(5) = 8
            asm(6) = 3
            asm(7) = 69
            asm(8) = 12
            asm(9) = 137
            asm(10) = 236
            asm(11) = 93
            asm(12) = 194
            asm(13) = 8
            asm(14) = 0
     
      If VirtualProtectEx(-1, VarPtr(asm(0)), UBound(asm) + 1, &H40, InitAsmAddFunc) = 0 Then _
         Err.Raise 11000, , "VirtualProtectEx Failed"
      If FlushInstructionCache(-1, VarPtr(asm(0)), UBound(asm) + 1) = 0 Then _
         Err.Raise 11001, , "Failed to flush instruction cache"
         
      InitAsmAddFunc = VarPtr(asm(0))
    End Function
    Olaf

  21. #501

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Schmidt View Post
    For comparison (using an RC5 or RC6-Project-Reference):
    Code:
    Option Explicit
    
    Private Declare Function VirtualProtectEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, ByRef lpflOldProtect As Long) As Long
    Private Declare Function FlushInstructionCache Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal dwSize As Long) As Long
    
    Public Sub Main()
       MsgBox AsmAdd(4, 7)
    End Sub
    
    Public Function AsmAdd(ByVal a As Long, ByVal b As Long) As Long
      Static pF&: If pF = 0 Then pF = InitAsmAddFunc
      AsmAdd = New_c.stdCall(retLong, pF, a, b)
    End Function
    
    Private Function InitAsmAddFunc() As Long
     Static asm(0 To 14) As Byte
            asm(0) = 85
            asm(1) = 137
            asm(2) = 229
            asm(3) = 139
            asm(4) = 69
            asm(5) = 8
            asm(6) = 3
            asm(7) = 69
            asm(8) = 12
            asm(9) = 137
            asm(10) = 236
            asm(11) = 93
            asm(12) = 194
            asm(13) = 8
            asm(14) = 0
     
      If VirtualProtectEx(-1, VarPtr(asm(0)), UBound(asm) + 1, &H40, InitAsmAddFunc) = 0 Then _
         Err.Raise 11000, , "VirtualProtectEx Failed"
      If FlushInstructionCache(-1, VarPtr(asm(0)), UBound(asm) + 1) = 0 Then _
         Err.Raise 11001, , "Failed to flush instruction cache"
         
      InitAsmAddFunc = VarPtr(asm(0))
    End Function
    Olaf
    That's pretty neat. I was more than a bit curious to see how you would have tackled this to be honest. Also, that's a very clever use of static variables. Extremely efficient way of creating the array while and preserving it on the heap at the same time. You really are gifted. If I had even a 10th of your abilities, you would have to kill me to use something like VB6. Imagine the miracles you could work with something more powerful! I have no idea why someone would waste such talent in something like VB6. But I digress.

    Quote Originally Posted by Schmidt View Post
    It's not that "VB6-code is far more complicated" - it's just you (not knowing how to do it properly).
    This is exactly my point. I didn't know how to do it properly. What do you think it would it have taken for me to do it properly? A lot more effort than it would have taken to learn to do it in .Net. Google didn't lead me to your solution using your RichClient library. It led me to the one I tried. That one failed which means I would have to roll up my sleeves spend a whole lot of time trying to figure out why it didn't work.

    Doing it in .Net doesn't require all of this effort. The ability to call function pointer is built right into the framework and this is true with just about everything, whether it's parsing XML or making HTTP requests. And all of it is supported by a tonne of official documentation that's very easy to find. There is no need for me to go hunting all over the internet looking for libraries like your RichClient or obscure posts buried in a forum somewhere like Trick's post about calling function pointers.

    This brings me to another point. Your solution, as elegant as it is, is not easily discoverable. Sure, I could have asked for the answer and easily gotten it. But that's a problem too. I'm reminded of Jemidiah. He was basically you in the math sub forum, a top tier math guy. He helped me immensely with some math when I was writing a 2D engine. But he hasn't been here since 2015. The guy is gone. Luckily, math is a generic topic and there are probably many forums out there with guys just as good as him to answer math questions. But how many of you are there? How many people do you think there are on this forum that would be able to solve this problem as easily as you did? You, The trick, wqweto and maybe dilettante? What happens when you guys all leave? What happens to VB6 programmers when you guys aren't around to help with problems like this? How many people do you think there are like you outside of these forums still willing and able to answer the tougher and more technical VB6 questions? Side note: I actually did see a VB6 question on StackOverflow like last month that I knew for sure someone here would be able to answer, but no one there was even close to a solution and this is StackOverflow we are talking about....

    I just don't see any upside here to be honest. Like why would anyone want to put themselves at such a disadvantage? And the thing is, it doesn't even have to be about .Net. There are so many modern development tools and languages that are just far better. Why VB6? How can anyone claim with a straight face that VB6 is better than any modern alternative? It just makes no sense.
    Last edited by Niya; Sep 9th, 2021 at 02:11 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  22. #502
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Also if using dotnet core for the console app you would potentially have a valid Linux app as well.

  23. #503

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by PlausiblyDamp View Post
    Also if using dotnet core for the console app you would potentially have a valid Linux app as well.
    Oh yea....
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  24. #504
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by PlausiblyDamp View Post
    Also if using dotnet core for the console app you would potentially have a valid Linux app as well.
    If more features related to function pointers are added to RC6, a lot of unnecessary controversy may be settled.

    In addition, maybe one day RC-Core will be released without warning, and it will be used in Linux-Apps.

    Edit:
    I've been thinking about a problem, if we can find a way to use VB6-events to handle all function pointers, it would be a perfect solution
    Last edited by SearchingDataOnly; Sep 9th, 2021 at 09:43 PM.

  25. #505

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    I want to revisit what I said previously when I said this:-
    Quote Originally Posted by Niya View Post
    This is exactly my point. I didn't know how to do it properly. What do you think it would it have taken for me to do it properly? A lot more effort than it would have taken to learn to do it in .Net. Google didn't lead me to your solution using your RichClient library. It led me to the one I tried. That one failed which means I would have to roll up my sleeves spend a whole lot of time trying to figure out why it didn't work.

    Doing it in .Net doesn't require all of this effort. The ability to call function pointer is built right into the framework and this is true with just about everything, whether it's parsing XML or making HTTP requests. And all of it is supported by a tonne of official documentation that's very easy to find. There is no need for me to go hunting all over the internet looking for libraries like your RichClient or obscure posts buried in a forum somewhere like Trick's post about calling function pointers.
    Here is an example of this very thing I described. A fellow wanted to know how to perform multithreading in VB6 and look at the answers he got. All kinds of monkey tricks with ActiveX EXEs and shelling out to different processes. Someone even suggesting CreateThread which is a horrible solution since you must take COM apartments into consideration and he didn't even mention that. You can't just use CreateThread in VB6 without also doing something about COM. No one there knew how to accomplish it or where to send the guy for an answer. And this is StackOverflow we are talking about here, one of the highest quality sites for information on programming. This is exactly the kind of pain you can avoid by just getting away from VB6 and using something more modern like VB.Net. In .Net this would have been dog easy to do and there is an overwhelming amount of documentation on how to do it that is very easy to find. Most of the time the issue is not whether VB6 can do something but how easy is it to do and how easy is it to find the information on how to do it.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  26. #506
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    JFYI, just fixed the links in the top answer on the SO questions so the in-process multi-threading sample is reachable through PSC organization on github.

    Completely agree that any kind of multi-threading is problematic in VB6 esp. debugging any of it in the IDE and yet somehow people deal with it e.g. allow multi-threading in compiled projects only.

    C/C++ developers still use printf debugging (or console.log recently) which is a bit strange for VB6-ers but not such a big deal in the end.

    cheers,
    </wqw>

  27. #507

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by wqweto View Post
    JFYI, just fixed the links in the top answer on the SO questions so the in-process multi-threading sample is reachable through PSC organization on github.
    Whoa. I knew it was possible to do multithreading in VB6 once you can get past COM but damn! I didn't expect that to be so complicated. Mostly referring to the way objects have to be treated in the ThreadProc. No way someone could come up with that on their own without a fairly deep understanding of COM and VB6's relationship with COM.
    Last edited by Niya; Sep 16th, 2021 at 06:59 AM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  28. #508
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    It was first M. Curland who demonstrated that on the new thread a call to CoInitialize is not enough to get away with running other VB6 code but you have to explicitly initialize the VB6 runtime on the new thread by creating an instance of an *external* VB6 class (in a DLL/OCX) the way a C/C++ client would instantiate VB6 classes on such green threads.

    The trouble with this instantiation done in VB6 code is that it has to be done without the code using any functionality from the VB6 runtime as it's not initialized yet on the new thread, so all API functions leading to the CoCreateInstance call are from a TLB (not ordinary declares) just so the code can thread lightly around touching anything from the currently unintilized VB6 runtime.

    cheers,
    </wqw>

  29. #509

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by wqweto View Post
    It was first M. Curland who demonstrated that on the new thread a call to CoInitialize is not enough to get away with running other VB6 code but you have to explicitly initialize the VB6 runtime on the new thread by creating an instance of an *external* VB6 class (in a DLL/OCX) the way a C/C++ client would instantiate VB6 classes on such green threads.

    The trouble with this instantiation done in VB6 code is that it has to be done without the code using any functionality from the VB6 runtime as it's not initialized yet on the new thread, so all API functions leading to the CoCreateInstance call are from a TLB (not ordinary declares) just so the code can thread lightly around touching anything from the currently unintilized VB6 runtime.

    cheers,
    </wqw>
    That is both amazing and insane....at the same time!

    There was a time I would thoroughly enjoy such amazing hacks but as I get older, I realized that they tend to hamper productivity a quite bit, especially when you lack the expertise to come up with them yourself. Even when you do know about them, they can be damn tedious to implement and debug!

    I guess .Net has spoiled me this way too because you almost never need to hack it like that to get simple things like multithreading things working. You really learn to appreciate it when things are made simple.
    Last edited by Niya; Sep 16th, 2021 at 01:56 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  30. #510
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Probably no one had ever tried my PSC (Planet Source Code) tool (somewhere in PSC thread in VB6 subforum) to extract projects from CDs and to create the repos in Gitea. But it contains some examples of features that languages like VB.NET (and in general the platform) added during the years.

    Simple example from the source:
    VB.NET Code:
    1. If config.ParallelPrepareRepos Then
    2.     Parallel.ForEach(dirs.ToList(),
    3.         Sub(prj)
    4.            PrepareRepo(prj, picsDir, config.FilesToRemove, config.GitRequiredFiles, subs, destRoot)
    5.         End Sub)
    6. Else
    7.     For Each prj In dirs
    8.         PrepareRepo(prj, picsDir, config.FilesToRemove, config.GitRequiredFiles, subs, destRoot)
    9.     Next
    10. End If
    Ignore extra lines that are only for readability as this was my primary task. But this shows how TPL (Task Parallel Library) can be used to run as max tasks (it can be limited via parameter) according current CPU abilities in the processing of simple For Each loop.

    And, as Niya pointed somewhere in this forum, async/await pattern is really powerful. It is also used in the PSC2Gitea project I created to create repository on Gitea server using web API. Just simple Dim resp = Await _http.PostAsync(url, content) in the Private Async Function CreateRepoAsync(repoName As String) As Task(Of Boolean) Implements IGitServerManagement.CreateRepoAsync function.

    Another code in my PSC2Gitea tool is the use of ORM library Dapper in very simple SELECT operation but reducing the code written (and also giving the ability to write db access as code first, but this is not important to DGV lovers).

  31. #511

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by peterst View Post
    And, as Niya pointed somewhere in this forum, async/await pattern is really powerful.
    I mentioned it as a must-have discussion for the development of TwinBASIC here. Async/Await is a must if you want your language to be competitive in 2021. It is probably the best asynchronous pattern we have ever seen. Writing asynchronous code the same way you write synchronous code is such a marvelous revolution.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  32. #512
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by wqweto View Post
    It was first M. Curland who demonstrated that on the new thread a call to CoInitialize is not enough to get away with running other VB6 code but you have to explicitly initialize the VB6 runtime on the new thread by creating an instance of an *external* VB6 class...
    JFYI, I was using DirectCOM.dll (produced with PowerBasic) as the "trampoline" to spawn STA-threads in that manner,
    already *before* the "Curland Book" came out (regfree, I might add).
    The regfree loading-stuff (within DirectCOM.dll), I gathered from C-examples at that time.
    https://www.vbforums.com/showthread....-dll-HelperLib

    The VB6/VBA community is (was) able to use DirectCOM.dll for two decades now (to lower the efforts with COM-Dll-based threading).

    Also (mainly @Niya) - the "normal, easy and well documented way" to do threading in VB6, was always via ActiveX-Exes (coffee-example).

    Then it was also me, who came up first with the CreateObject-trick, to force these "OutOfProcess"-AX-Exe-Threading-Demos,
    to work "InProcess" (in the same AX-Executable - with quite similar UseNet-posted demos like this one here).
    https://www.vbforums.com/showthread....d-Threading%29

    Olaf

  33. #513

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Schmidt View Post
    Also (mainly @Niya) - the "normal, easy and well documented way" to do threading in VB6, was always via ActiveX-Exes (coffee-example).
    Oh I'm well aware of that. A lifetime ago I first discovered the concept of multi-threading when I came across an online document about CreateThread. I remember very clearly wondering if VB6(or perhaps it VB5, it was that long ago) can do it. I must have went over that Coffee server document cover to cover multiple times. I looked at several C/C++/Win32 samples, which showed how to freely execute functions on other threads and I was wondering why the the classic VB sample required an entire server application to do it. In fact, this is the very reason I went over that sample/document so many times because I simply could not believe this was so much simpler in Win32 and C/C++. I had to have missed something right? Surely this convoluted server mess wasn't the only way to do this. Turns out, it was, at least the only recommended way to do it. To achieve the simplicity I was seeing in C++ samples with CreateThread required quite a bit of hacking in classic versions of VB. To this day my feelings on this have never changed. Using ActiveX EXEs just to create multi-threaded applications is too convoluted and confusing and in my opinion, a complete garbage way to implement multi-threading.

    This very topic of multi-threading was actually one of the biggest reasons I abandoned VB6 for .Net because when I saw how simple it was to do in .Net, I just couldn't resist. What won me over is that it was even simpler than using CreateThread, which is exactly what I expected from VB, a product who's main selling point has always been simplicity. I'm sure ActiveX EXEx have their uses and I'm sure it may be quite good when used at the right time but if all you want to do is spin up a loop on a worker thread, using ActiveX EXEs is just to do that simple thing is a trash way to go about it and whoever thought that this was sufficient for VB6 must have been drunk out of their minds.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  34. #514
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Niya View Post
    This very topic of multi-threading was actually one of the biggest reasons I abandoned VB6 for .Net ....

    ...using ActiveX EXEs just to do that simple thing is a trash way to go about it ...
    You never really understood COM Niya (STAs can really make threading easy and safe for inexperienced Users), and besides -
    the .NET equivalent of the little Mandelbrot-AxExe-Example was "wordier" and ran slower than the VB6-example IIRC.

    You failed to make your point with threading years ago, when I posted this example - and this has not changed to this day.

    Olaf

  35. #515

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Schmidt View Post
    You never really understood COM Niya (STAs can really make threading easy and safe for inexperienced Users)
    Code:
        Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Task.Run(Sub()
                         For i = 1 To 10
                             Threading.Thread.Sleep(500)
                             Me.Invoke(Sub()
                                           Label1.Text = i.ToString
                                       End Sub)
    
                         Next
                     End Sub)
    
        End Sub
    It's that simple in .Net. It requires no special imports, no extra projects and nothing fancy. Took me about 1 minute to write that. Easy.

    Let's not pretend ActiveX EXEs make that so straightforward. I don't remember the Coffee server being that simple. There is no debate here which way is better.

    I mean look at this. Does any of that look simple to you? All this wizardry that COM has to perform with apartments, all of these shenanigans with global variables, the need to "trick" COM into thinking you're a remote client? We don't have to deal with all that nonsense in .Net. When we want a thread, we just spin up one. Simple.

    I'm sorry and this is just my opinion but threading in COM is garbage. It's overly complicated and unintuitive. Inexperienced users are more likely to shoot themselves in the foot using that overly complicated piece of trash than they are with Task and Thread classes in .Net. Even the Win32 CreateThread API is simpler than that. We haven't even brought Await/Async into the discussion which makes things even easier. With Async/Await the above code becomes even simpler in .Net:-
    Code:
        Private Async Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            For i = 1 To 10
                Await Task.Delay(500)
                Label1.Text = i.ToString
            Next
        End Sub
    Though the above code is not actually multithreaded it does the exact same thing as the threaded code I posted above. It achieves the same goal of running a task while keeping the UI responsive.

    "STAs make threading safe and easy" Get real.

    Quote Originally Posted by Schmidt View Post
    the .NET equivalent of the little Mandelbrot-AxExe-Example was "wordier" and ran slower than the VB6-example IIRC.
    "wordier"? lol...If you say so. I have a vague memory of that discussion. I'll have to go back and see what we actually did before I make any comment on this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  36. #516
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Schmidt View Post
    JFYI, I was using DirectCOM.dll (produced with PowerBasic) as the "trampoline" to spawn STA-threads in that manner,
    already *before* the "Curland Book" came out (regfree, I might add).
    The regfree loading-stuff (within DirectCOM.dll), I gathered from C-examples at that time.
    https://www.vbforums.com/showthread....-dll-HelperLib

    The VB6/VBA community is (was) able to use DirectCOM.dll for two decades now (to lower the efforts with COM-Dll-based threading).
    Wait, using an external DLL for in-proc multi-threading is available since VB5 w/ at least a dozen commericial offerings too (mainly written in C/C++).

    Curland first demonstrated how to to do proper in-proc multi-threading *without* helper DLLs needed at runtime. (Proper meaning using not only Beep routine on the new thread.)

    Everyone since is rehashing the same approach of calling CoCreateInstance using typelib imports only.

    cheers,
    </wqw>

  37. #517
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by wqweto View Post
    Wait, using an external DLL for in-proc multi-threading is available since VB5 w/ at least a dozen commericial offerings too (mainly written in C/C++).
    Didn't find any at that time, which created the (ThreadWorker-)Class-instance (from an AX-Dll) regfree on an STA.

    Quote Originally Posted by wqweto View Post
    Everyone since is rehashing the same approach of calling CoCreateInstance using typelib imports only.
    With the regfree approach, the call to CoCreateInstance was of course avoided,
    using PBs convenient "Call-By-FunctionPointer" on the first (above IUnkown) VTbl-method of the ClassFactory-instance.
    (that of course, was then in turn doing the same VB-Runtime-Init as the CoCreateInstance-Wrapper indirectly triggers under the covers).

    And yes, I was not aware at that time (before the book came out), that with typelib-defined APIs (which avoided the "Err-Object"), I could have done the same thing directly in VB6, which I used PowerBasic for.

    In that regard the Curland-Book (the only "Coding-related" Book I ever bought) shed a whole lot of light on a whole lot of "issues". (Had wished to have access to the VB6-sources at that time myself <g>)

    Olaf
    Last edited by Schmidt; Sep 20th, 2021 at 11:40 PM.

  38. #518
    Fanatic Member Episcopal's Avatar
    Join Date
    Mar 2019
    Location
    Brazil
    Posts
    547

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Quote Originally Posted by Niya View Post
    Visual Basic 6
    Code:
    Private Type vbRECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    
    Private Type TEXTRUN
        TextString As String
        FontSize As Long
        TextColor As Long
        
        'Note: THIS FIELD IS NOT MEANT TO BE WRITTEN TO BY THE
        'PROGRAMMER
        CALCULATEDRECT As vbRECT
    End Type
    
    Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As vbRECT, ByVal wFormat As Long) As Long
    
    Private Declare Function DrawFocusRect Lib "user32" (ByVal hDc As Long, lpRect As vbRECT) As Long
    
    Private Const DT_SINGLELINE = &H20
    Private Const DT_CALCRECT = &H400
    Private Const DT_CENTER = &H1
    Private Const DT_VCENTER = &H4
    Private Const DT_BOTTOM = &H8
    
    
    Private Sub Form_Paint()
        Dim text(0 To 2) As TEXTRUN
        
        text(0).FontSize = 40
        text(0).TextColor = RGB(255, 0, 0)
        text(0).TextString = "Red"
        
        text(1).FontSize = 25
        text(1).TextColor = RGB(0, 0, 0)
        text(1).TextString = " and "
        
        text(2).FontSize = 40
        text(2).TextColor = RGB(0, 0, 255)
        text(2).TextString = "Blue"
    
        DrawTextCentered text
    
    End Sub
    
    Private Sub Form_Resize()
        Me.Refresh
    End Sub
    
    
    Private Sub DrawTextCentered(text() As TEXTRUN)
            
        Dim previousScaleMode As Long
        Dim prevFontSize As Long
        Dim prevForeColor As Long
        Dim textHeight As Long
        Dim textWidth As Long
        Dim textLeft As Long
        Dim textTop As Long
        Dim r As vbRECT
        
        
        previousScaleMode = Me.ScaleMode
        prevFontSize = Me.Font.Size
        prevForeColor = Me.ForeColor
       
        'We are assuming that when DrawText called on the Form's DC
        'that the MM_TEXT mapping mode is used. MM_MODE is basically saying
        'we are working in pixels. Because of this we need our
        'Form to be measuring in pixels so we change the ScaleMode otherwise
        'the only way to be sure is to import more of the Win32 API to measure
        'in pixels.
        Me.ScaleMode = vbPixels
        
        For i = LBound(text) To UBound(text)
            Me.Font.Size = text(i).FontSize
            Me.ForeColor = text(i).TextColor
          
            DrawText Me.hDc, text(i).TextString, -1, text(i).CALCULATEDRECT, DT_CALCRECT
        
            If text(i).CALCULATEDRECT.Bottom > textHeight Then textHeight = text(i).CALCULATEDRECT.Bottom
            textWidth = textWidth + text(i).CALCULATEDRECT.Right
        
        Next
       
        textLeft = (Me.ScaleWidth \ 2) - (textWidth \ 2)
        textTop = (Me.ScaleHeight \ 2) - (textHeight \ 2)
    
        For i = LBound(text) To UBound(text)
            Me.Font.Size = text(i).FontSize
            Me.ForeColor = text(i).TextColor
            
            r.Left = textLeft
            r.Top = textTop
            r.Right = r.Left + text(i).CALCULATEDRECT.Right
            r.Bottom = textTop + textHeight
            
            DrawText Me.hDc, text(i).TextString, -1, r, DT_SINGLELINE Or DT_BOTTOM
            'DrawFocusRect Me.hDc, r
            
            textLeft = textLeft + text(i).CALCULATEDRECT.Right
        Next
        
        Me.ScaleMode = previousScaleMode
        Me.Font.Size = prevFontSize
        Me.ForeColor = prevForeColor
    
    
    End Sub


    Visual Studio 2019 + XAML(VB.Net or C#)
    Code:
        <Grid>
            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" >
                <Run FontSize="40" Foreground="Red">Red</Run>
                <Run FontSize="20"> and </Run>
                <Run FontSize="40"  Foreground="Blue">Blue</Run>
            </TextBlock>
        </Grid>


    Less typing. Works better.

    *mic drop*

    Noble Niya

    Who am I? I'm nobody.

    A long time ago I took a Java short course. And in it I found that we would have to type a lot to get something. The speaker said that Java is very verbose.

    If we have to type a lot, does that constitute inferiority? Do you mean that VB6 and VB.NET is superior to Java, because Java is verbose?

    I know it's not, but from the point of view presented, I took it seriously that Java is inferior.

    I know NET goes further than VB6.

  39. #519

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    I'm guessing that verbosity he is talking about comes from all the ThisNamespace.NestedNamespace.NestedNamespace.WhateverClass.Whatevermethod mess we see in both Java and .Net. However, this is more of less moot. I can't speak for Java but this in .Net, the Visual Studio IDE intellisense helps a lot with this so it greatly reduces the actual amount of typing you have to do and also, you can use imports to completely eliminate this need for these long ass fully qualified names. You can do both file scoped and project scoped imports of as many namespaces as you want. In fact, I use file scoped imports to eliminated this in my own code. The Visual Studio IDE even offers to perform these imports for me automatically.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  40. #520

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Why is VB.Net/C#/XAML + VS2019 is better than VB6? Here's why.....

    Also, with regards to the subject of verbosity. Verbosity can be better only if it makes code easier to understand. A very common example you would see with me is variable, class and method names. If you ever look at any code I write, you would notice I tend to use very long names.

    I can even make a direct comparison. In a recent discussion about function pointers, I wrote a function and called it CallFunctionPointer. Olaf also wrote this same function for his vbRichClient library and he called it StdCall. This is a bad example because in this particular case the name of his function actually communicates more information. However, I know myself well enough to know that if I wanted to communicate calling convention information I would have named it something like CallFunctionPointerStdCall or StdCallFuncPtr. Both these names communicate more information at a glance than just StdCall. You know at a glance everything that function does, it calls a function through a pointer using the standard calling convention.

    However, I want to also say that this point is extremely subjective and not one I'm willing to wrangle over. I have no problems whatsoever with short identifier names. I just happen to prefer longer ones personally. I like when I read my own code years later, I can quickly get an idea of what everything is and what they do because my names are so descriptive.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Page 13 of 24 FirstFirst ... 31011121314151623 ... LastLast

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