Public Class Form1 Private Declare Auto Function SendMessage Lib "USER32" _ (ByVal hWnd As IntPtr, _ ByVal msg As Integer, _ ByVal wParam As Integer, _ ByVal lParam() As Integer) As IntPtr '''<summary>複数行テキストボックスのタブストップ位置を設定する</summary> '''<param name="Pos">指定なし=規定の設定値を使用。1個指定=一定間隔に配置、2個以上指定=指定した位置</param> Public Shared Sub SetTabPos(ByVal TextBox As TextBoxBase, ByVal ParamArray Pos() As Integer) Const EM_SETTABSTOPS As Integer = &HCB If Pos Is Nothing Then ReDim Pos(-1) SendMessage(TextBox.Handle, EM_SETTABSTOPS, Pos.Length, Pos) End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load 'SetTabPos(TextBox2, 20, 40, 60) SetTabPos(TextBox2, 20) End Sub Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim s As String = "abc" & vbTab & "def" & vbTab & "GHQ" & vbCrLf _ & "123" & vbTab & "456" & vbTab & "789" TextBox1.Text = s TextBox2.Text = s End Sub End Class