Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3305618
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:11:26+00:00 2026-05-17T21:11:26+00:00

Does anyone know of a good reference for VB6 format-strings? Does anyone know of

  • 0
  1. Does anyone know of a good reference for VB6 format-strings?
  2. Does anyone know of a converter from VB6 formatting strings to .NET strings?

I’m working on porting a large VB6 code base to .NET. It is a database centric piece of software, and the database itself holds VB6 format-strings which are later loaded and used to display other data in the database.

My question, like this article, is how to port this. However the answer chosen for that question isn’t adequate for my needs. I’m uncomfortable relying on libraries specifically designed for backwards compatibility with a language I’ve been specifically hired to port away.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:11:27+00:00Added an answer on May 17, 2026 at 9:11 pm

    The formatting routine that VB6 uses is actually built into the operating system. Oleaut32.dll, the VarFormat() function. It’s been around for 15 years and will be around for ever, considering how much code relies on it. Trying to translate the formatting strings to a .NET composite formatting string is a hopeless task. Just use the OS function.

    Here’s a sample program that does this, using the examples from the linked thread:

    using System;
    using System.Runtime.InteropServices;
    
    class Program {
        static void Main(string[] args) {
            Console.WriteLine(Vb6Format("hi there", ">"));
            Console.WriteLine(Vb6Format("hI tHeRe", "<"));
            Console.WriteLine(Vb6Format("hi there", ">!@@@... not @@@@@"));
            Console.ReadLine();
        }
    
        public static string Vb6Format(object expr, string format) {
            string result;
            int hr = VarFormat(ref expr, format, 0, 0, 0, out result);
            if (hr != 0) throw new COMException("Format error", hr);
            return result;
        }
        [DllImport("oleaut32.dll", CharSet = CharSet.Unicode)]
        private static extern int VarFormat(ref object expr, string format, int firstDay, int firstWeek, int flags,
            [MarshalAs(UnmanagedType.BStr)] out string result);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a good online resource which gives a clear reference on
Does anyone know how to perform or have a good reference for doing an
Does anyone know a good reference to look into what Object Relational features are
Does anyone know any good reference on how to write Yii framework extensions? I've
Does anyone know of a good reference that lists which calls are interruptable? I
Does anyone know of a good reference or rule of thumb for when to
Does anyone know of some good reference implementations of common design patterns in Ada?
Does anyone know any good app delegation reference? The type where it tells you
Does anyone know good example of using CSS to create rounded corner box where:
Does anyone know a good place to look for basic principles and tutorials on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.