🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.lang.visualbasic
Article #444

Re: 標準のコンボボックスでの入力文字数制限に付いて

#444
From: kamayan
Date: Thu, 26 Feb 1998 00:00
26 lines
1340 bytes
>Private Sub Combo1_KeyPress(KeyAscii As Integer)
>
・・・省略・・・
>
>End Sub
>

Windows95/NT4.0では、コンボボックスの右クリックメニューに、
「貼り付け」もあるので、KeyPressイベントが発生しません。そん
なわけで、Changeイベントを利用するのが良いと思います。

Private Sub Combo1_Change()

    Dim str1 As String
    Dim a As Long

    str1 = Combo1.Text
    a = LenB(StrConv(str1, vbFromUnicode))

    If a > 10 Then  ' 10バイト(S-JIS)に制限する
        ' ここでまたChangeイベントが発生するところがミソ
        Combo1.Text = Left(str1, Len(str1) - 1) 
    End If

End Sub
Technical Details
Message-ID: <6d2rls$3el$1@fu2.bekkoame.or.jp>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6d0k75$r2i$1@nn-os001.ocn.ad.jp> <6d0qrq$7ab$1@hawaii.ykhm.cij.co.jp>

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: 105c2e,f56fb090110a2966
X-Google-Attributes: gid105c2e,public
From: "kamayan" <ciwikou@aol.com>
Subject: Re: 標準のコンボボックスでの入力文字数制限に付いて
Date: 1998/02/26
Message-ID: <6d2rls$3el$1@fu2.bekkoame.or.jp>
X-Deja-AN: 328736695
Content-Transfer-Encoding: 7bit
References: <6d0k75$r2i$1@nn-os001.ocn.ad.jp> <6d0qrq$7ab$1@hawaii.ykhm.cij.co.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-2022-jp"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: BEKKOAME INTERNET INC.
Newsgroups: fj.lang.visualbasic