我先将文本框设置为多行文本,那末请问如何获得每一行文本的内容?(如方便请付代码)
解决方案 »
- vb6访问webservice问题
- VB6 如何设置IP地址
- 求平均值
- 如何使用VB操作EXCLE當案使EXCEL中的簡體轉換為繁體
- 在VB里调用C遍的可执行程序有几种方法?怎么传参数?
- Text控件中的文本要如何分开:如,我在文本中显示的是06:00:00,我应如何做才能在文本击中文本框中的06,便选中06。如果点中00,选的是00
- Ctrl+Z在vb中代码如何写?
- 请教高手:怎样取汉字点阵信息?????
- 求优秀的Grid控件?求优秀的Grid控件?求优秀的Grid控件?求优秀的Grid控件?
- 在使用ADO的ADDNEW方法增加一个新记录后返回后,如何让指针定位到新增加的记录上?
- 请教下拉列表问题
- 怎样识别条形码?
Dim TempStrs() as String
TempStrs=Split(Text1.Text,vbCrLf)
第n行=TempStrs(n)2.发送EM_GETLINE消息
EM_GETLINE
An application sends an EM_GETLINE message to copy a line of text from an edit control and place it in a specified buffer. EM_GETLINE
wParam = (WPARAM) line; // line number to retrieve
lParam = (LPARAM) (LPCSTR) lpch; // address of buffer for line
Parameters
line
Value of wParam. Specifies the zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This parameter is ignored by a single-line edit control.
lpch
Value of lParam. Pointer to the buffer that receives a copy of the line. The first word of the buffer specifies the maximum number of characters that can be copied to the buffer.
Return Values
The return value is the number of characters copied. The return value is zero if the line number specified by the line parameter is greater than the number of lines in the edit control. Res
The copied line does not contain a terminating null character. QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Split函数
描述返回一个下标从零开始的一维数组,它包含指定数目的子字符串。语法Split(expression[, delimiter[, count[, compare]]])Split函数语法有如下几部分:部分 描述
expression 必需的。包含子字符串和分隔符的字符串表达式 。如果expression是一个长度为零的字符串(""),Split则返回一个空数组,即没有元素和数据的数组。
delimiter 可选的。用于标识子字符串边界的字符串字符。如果忽略,则使用空格字符(" ")作为分隔符。如果delimiter是一个长度为零的字符串,则返回的数组仅包含一个元素,即完整的 expression字符串。
count 可选的。要返回的子字符串数,–1表示返回所有的子字符串。
compare 可选的。数字值,表示判别子字符串时使用的比较方式。关于其值,请参阅“设置值”部分。
设置值compare参数的设置值如下:常数 值 描述
vbUseCompareOption –1 用Option Compare语句中的设置值执行比较。
vbBinaryCompare 0 执行二进制比较。
vbTextCompare 1 执行文字比较。
vbDatabaseCompare 2 仅用于Microsoft Access。基于您的数据库的信息执行比较。
Const EM_GETLINECOUNT = &HBA
Const EM_GETLINE = &HC4Private Sub Command1_Click()
Dim str(256) As Byte
str(1) = 1 '最大允许存放256个字符
'获取总行数,结果显示在文本框txtLineCount中
txtlineCount = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, 0)
'获取第3行的数据放在str中,转换为字符串后显示在文本框Text2中
SendMessage Text1.hwnd, EM_GETLINE, 2, str(0)
Text2.Text = StrConv(str, vbUnicode)
' Debug.Print txtstring
End Sub
Const EM_GETLINECOUNT = &HBA
Const EM_GETLINE = &HC4Private Sub Command1_Click()
Dim str(256) As Byte
str(1) = 1 '最大允许存放256个字符
'获取总行数
txtlineCount = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, 0)
'获取第3行的数据放在str中,转换为字符串后显示在文本框Text2中
SendMessage Text1.hwnd, EM_GETLINE, 2, str(0)
Text2.Text = StrConv(str, vbUnicode)
End Sub
selstart
sellength
setfocus
利用粘贴,剪切,复制原理
selstart
sellength
setfocus
你试一试。