Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to align output to text file in vb.net

How to align output to text file in vb.net

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestioncsharphelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andraw Tang
    wrote on last edited by
    #1

    Hi, dear all I need to create a text file with each control at a line, in this line, it include control value, control name and description, the output should be as the following: False Print - XXXXXXXXXXXXXXXXXXXXXXXXXX 2 Contrl 1 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 3.6 Control 2 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 23.8 Control 3 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 0.005 Control 4 - XXXXXXXXXXXXXXXXXXXXXX The problem is align the column 1, how can I align the decimal point at same position at each line, and prefix the heading as space? and the heading space number is changed according the value? For example, for contrl 1 and control 2, the heading space is 3, but for control 3, it's 2. I use something like: value = Format(Contrl1, " 0") Writer.WriteLine(value.PadRight(ValueFieldLen) & _ "Contrl 1".PadRight(ContrlFieldLen) & _ "- XXXXXXXXXXXXXXXXXXXXXXXXXX") value = Format(Contrl3, " 0.0") Writer.WriteLine(value.PadRight(ValueFieldLen) & _ "Control 3".PadRight(ContrlFieldLen) & _ "- XXXXXXXXXXXXXXXXXXXXXXXXXX") In this way, the prefix spacing is fixed, this isnot I want. Thanks!

    T C 2 Replies Last reply
    0
    • A Andraw Tang

      Hi, dear all I need to create a text file with each control at a line, in this line, it include control value, control name and description, the output should be as the following: False Print - XXXXXXXXXXXXXXXXXXXXXXXXXX 2 Contrl 1 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 3.6 Control 2 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 23.8 Control 3 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 0.005 Control 4 - XXXXXXXXXXXXXXXXXXXXXX The problem is align the column 1, how can I align the decimal point at same position at each line, and prefix the heading as space? and the heading space number is changed according the value? For example, for contrl 1 and control 2, the heading space is 3, but for control 3, it's 2. I use something like: value = Format(Contrl1, " 0") Writer.WriteLine(value.PadRight(ValueFieldLen) & _ "Contrl 1".PadRight(ContrlFieldLen) & _ "- XXXXXXXXXXXXXXXXXXXXXXXXXX") value = Format(Contrl3, " 0.0") Writer.WriteLine(value.PadRight(ValueFieldLen) & _ "Control 3".PadRight(ContrlFieldLen) & _ "- XXXXXXXXXXXXXXXXXXXXXXXXXX") In this way, the prefix spacing is fixed, this isnot I want. Thanks!

      T Offline
      T Offline
      Tim Craig
      wrote on last edited by
      #2

      VB???? What's that? X|

      Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.

      1 Reply Last reply
      0
      • A Andraw Tang

        Hi, dear all I need to create a text file with each control at a line, in this line, it include control value, control name and description, the output should be as the following: False Print - XXXXXXXXXXXXXXXXXXXXXXXXXX 2 Contrl 1 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 3.6 Control 2 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 23.8 Control 3 - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 0.005 Control 4 - XXXXXXXXXXXXXXXXXXXXXX The problem is align the column 1, how can I align the decimal point at same position at each line, and prefix the heading as space? and the heading space number is changed according the value? For example, for contrl 1 and control 2, the heading space is 3, but for control 3, it's 2. I use something like: value = Format(Contrl1, " 0") Writer.WriteLine(value.PadRight(ValueFieldLen) & _ "Contrl 1".PadRight(ContrlFieldLen) & _ "- XXXXXXXXXXXXXXXXXXXXXXXXXX") value = Format(Contrl3, " 0.0") Writer.WriteLine(value.PadRight(ValueFieldLen) & _ "Control 3".PadRight(ContrlFieldLen) & _ "- XXXXXXXXXXXXXXXXXXXXXXXXXX") In this way, the prefix spacing is fixed, this isnot I want. Thanks!

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        Please, ask your question in the VB forum. This forum is for C++.

        Cédric Moonen Software developer
        Charting control [v3.0] OpenGL game tutorial in C++

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups