When I first saw this post in the 9CBS VB Forum, I didn't find a solution for a long time. Later, I saw that ZY910 wrote "Due to the setting of the EDIT control (can only set the style when creating the window, can not be modified after being created)
So the principle of TextBox's multiline property is: first clear the original Edit, create a new Edit
This is feasible when designing. But at runtime, it will cause loss of text box-related data, and even cause illegal operations because of unsafe code, M $ is set to read when TextBox's multiline property is running, then "then use the TextBox control to meet Requirements.
In fact, we can find an alternative method, Microsoft gives us a set of windowless control libraries. The so-called "windowless control" is to see the name of the name, there is no window, so there is no hWnd property. This library is not mentioned in the primary language of the reference documentation, it must be manually installed from the common / tools / vb / winless directory. The installation method is to copy this directory to the hard disk, register it in REGSVR32 or VB, then double-click MSWLESS.REG, which creates registration keywords that enable ActiveX controls to VB environments. After registration, select Microsoft Windowless Control 6 from the list of available Active Controls from Press Ctrl T to load the function library into the IDE.
The benefits of using the Windowless library are limited to the internal controls at runtime, in fact, all properties can be changed at runtime. This library includes a window-called version -Mswless.wlText in this library. That is to say we can implement the text control of the multiline property by dynamically load this control.
Dim WitHevents TXTEDITOR As Mswless.wltext
Private submmand1_click ()
Set txteditor = controls.add ("msless.wltext", "txtedit")
TXTeditor.Multiline = TRUE
TXTeditor.Scrollbars = WLBOTH
TXTeditor.move 0, 0, Scalewidth, ScaleHeight
TXTeditor.visible = TRUE
End Sub
Note: "Engineering attribute" deletes related to unused
Active
The checkbox of the control is not selected.