17437.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 26 行

HTML
26
字号
<html>  <head>    <title>Why !? 我用如下的 code, but run time 时会有 语法错误 at : Public Function GetaLine(Text1 As TextBox, ByVal ntx As Long) As String</title>  </head>  <body bgcolor="#FFFFFF" vlink="#808080">    <center>      <h1>Why !? 我用如下的 code, but run time 时会有 语法错误 at : Public Function GetaLine(Text1 As TextBox, ByVal ntx As Long) As String</h1>    </center><hr size=7 width=75%><hr size=7 width=75%><p>Posted by Albert on August 18, 1999 at 10:55:21:<p>Option Explicit<br>Const EM_GETLINE = &HC4<br>Public Const EM_GETLINECOUNT = &HBA<br>Declare Function SendMessage Lib "user32" Alias "SendMessageA" _<br>        (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _<br>         lParam As Any) As Long<br> Public Function GetaLine(Text1 As TextBox, ByVal ntx As Long) As String<br> Dim str5(255) As Byte '如果您的字串 > 255 byte请自行增加该Byte Array<br> Dim str6 As String, i As Long<br> <br>    str5(0) = 255 '字串的前两个Byte存该字串的最大长度 str5(0) = 255<br>    i = SendMessage(Text1.hwnd, EM_GETLINE, ntx, str5(0))<br>    If i = 0 Then<br>        GetaLine = ""<br>    Else<br>        str6 = StrConv(str5, vbUnicode)<br>        GetaLine = Left(str6, InStr(1, str6, Chr(0)) - 1)<br>    End If<br>End Function<p><br>Option Explicit<br>Public Function TextBoxLineCnt(ctl As TextBox) As Long<br>TextBoxLineCnt = SendMessage(ctl.hwnd, EM_GETLINECOUNT, 0, 0)<br>End Function<p><br><br><hr size=7 width=75%><p><a name="followups">Follow Ups:</a><br><ul><!--insert: 17437--><!--top: 17438--><li><a href="17438.html">sorry 少加了几行 code, 请入内看</a> <b>Albert</b> <i>10:57:58 8/18/99</i>(<!--responses: 17438-->0)<ul><!--insert: 17438--></ul><!--end: 17438--></ul><!--end: 17437--><br><hr size=7 width=75%><p></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?