Home > Software engineering >  VB to read and write text
VB to read and write text

Time:09-22

How to use VB to read after the specified text
The text content with "|" symbol branch, and then I need the window of the output () is a software written to the window to write the first row of data (not to the last "|"), pick up a carriage return, working on the second line, write text content in turn out,
Like my text for

1111111111 | 2222222222 | | 3333333333 | 4444444444

CodePudding user response:

Change "vertical lines" to "enter a newline" :
Replace (" 1111111111 | 2222222222 | | 4444444444 | 3333333333 ", "|", vbCrLf)

Your "output" depends on the situation:
If the "target" is a text box (including static text box), with the SetWindowText can change its text content;
If it is other GDI objects, can only use TextOut () or other similar API text "painting" to its corresponding hDC,

CodePudding user response:

How can the input line by line?? Can directly to the code?

CodePudding user response:

Input box should be static text input box, is specially for the input data.

CodePudding user response:

Text content is variable, this how to write?

CodePudding user response:

refer to the second floor qq_27638887 response:
how can input line by line?? Can directly to the code?

From the "input"? The input to the "where"?
Don't talk irrelevant...


reference qq_27638887 reply: 3/f
input box should be static text input box, is specially for the input data.

Now that is "to enter", that is not called "static text box", that is called "text box" or "Edit box, controls the class name is" Edit "or its derived classes,
"Static text box" is only used for "show" on the interface, will not accept the "input", the class name is "Static",
Its Label control with VB6 similar (but not two kind of things),
If you want to retrieve text in the text box, you need to use SendMessage () the API to operation, send WM_GETTEXT message,


reference 4 floor qq_27638887 response:
text content is variable, this how to write?

Don't understand what you said is what mean!!!!!!
Feel you are with us, like is not a "dynasty",

CodePudding user response:

In the text box of a software (like VB text box), read line by line input to D: \ 1. TXT text content in each input with a carriage return a!

CodePudding user response:

The building Lord said input, it is the output of conventional sense? Whether the program reads a text file, and then write data branch to text box?

CodePudding user response:


The Split function


Description

Returns a one-dimensional array subscript from scratch, it contains the specified number of substrings,

Syntax

Split (expression [, delimiter, count, compare [] []])

Split function grammar has the following several parts:

Part of the description
Expression required, contains the substring and separator string expression, if the expression is a zero-length string (" "), Split it returns an empty array, namely no elements and data array,
Delimiter optional, a string used to identify the substring boundary character, if ignored, use the space character (" ") as a delimiter, if delimiter is a zero-length string, and returns an array of contains only one element, namely complete expression string,
Count optional, number of substrings to return - 1 said returns all the substring,
Compare optional, numeric values, says when judging the substring using comparative way, on its value, please refer to the "Settings" section,


Set the value

Compare parameter Settings are as follows:

Constant value description
VbUseCompareOption - 1 with Option Compare statement is within the set values,
VbBinaryCompare 0 perform a binary comparison,
VbTextCompare 1 perform text comparison,
VbDatabaseCompare 2 is only used to Microsoft Access, based on your database information to perform the comparison,
  • Related