🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.vbasic
Article #92473

Re: Pole tekstowe

#92473
From: stayheavy
Date: Mon, 31 Oct 2005 15:11
43 lines
2419 bytes
Użytkownik "skyblast" <skyblast@linuxmail.org> napisał w wiadomości 
news:dk5al1$2kr$1@nemesis.news.tpi.pl...
> Do blokowania wprowadzania liter w texbox-y używam czegoś takiego:
>
> Private Sub TextBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
>    If Not (IsNumeric(Chr(KeyAscii))) Then KeyAscii = 0
>    If IsNull(TextBox.Text) = True Then KeyAscii = 48
> End Sub

No niestety, nie dziala :/. Pojawia sie kominukat ze typ nie zosta wczesniej 
zdefiniowany. Mozliwe ze robie jakis blad, bo dopiero raczkuje w VB. Moj kod 
podpiety pod pole tekstowe wyglada tak:

Private Sub Text2_Change()

    If Text2.Text < 0 Then
        MsgBox ("The value must be from the range 0-255")
        Tex2.Text = 0
    ElseIf Text2.Text > 255 Then
        MsgBox ("The value must be from the range 0-255")
        Text2.Text = 0
    End If

    HScroll1.Value = Text2.Text

End Sub

Myslalem zeby uzyc czegos takiego:

If Not IsNumeric(Text2.Text) Then Text2.Text = ""

ale tez nie dziala.

Wartosc pola tekstowego, z racji tego czym jest, domyslnie chyba jest 
deklarowana jako String. W moim wypadku samoczynnie sie przedeklarowala na 
format numeryczny dzieki tym porownaniom <>0. Moze bredze bo nie znam 
tematu, ale nie da sie zadeklarowac na stale tego pola jako tekstowe? 
Idealem byloby zblokowanie liter, ale nie mam pojecia jak to zrobic zeby 
dzialalo.

Pozdr

stayheavy 
Technical Details
Message-ID: <dk5c96$7ll$1@nemesis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <dk58kf$8lp$1@atlantis.news.tpi.pl> <dk5al1$2kr$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: "stayheavy" <stayheavy@interia.pl>
Newsgroups: pl.comp.lang.vbasic
Subject: Re: Pole tekstowe
Date: Mon, 31 Oct 2005 16:11:53 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 45
Message-ID: <dk5c96$7ll$1@nemesis.news.tpi.pl>
References: <dk58kf$8lp$1@atlantis.news.tpi.pl> <dk5al1$2kr$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: aqq226.neoplus.adsl.tpnet.pl
X-Trace: nemesis.news.tpi.pl 1130771558 7861 83.26.176.226 (31 Oct 2005 15:12:38 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Mon, 31 Oct 2005 15:12:38 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit