How to align output to text file in vb.net
-
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!
-
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!
-
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!
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++