掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
数字を連番で表示するには? (ID:122013)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
[VB6.0] Option Explicit Private Sub Command1_Click() Dim wStartCnt As Integer Dim wTempCnt As Integer Dim wEndCnt As Integer If ErrChkText(Me.Text1) Then Exit Sub If ErrChkText(Me.Text2) Then Exit Sub wStartCnt = CInt(Me.Text1.Text) wEndCnt = CInt(Me.Text2.Text) If wStartCnt > wEndCnt Then wTempCnt = wStartCnt wStartCnt = wEndCnt wEndCnt = wTempCnt End If With Me.List1 .Clear For wTempCnt = wStartCnt To wEndCnt .AddItem CStr(wTempCnt) Next End With End Sub Private Function ErrChkText(ByVal TextBoxX As TextBox) As Boolean Dim TextX As String With TextBoxX TextX = Trim(.Text) If Len(TextX) = 0 Then MsgBox .Name & " を入力して下さい。" .SetFocus ErrChkText = True Exit Function ElseIf Not IsNumeric(TextX) Then MsgBox "数値として有効な値を入力して下さい。" .SetFocus ErrChkText = True Exit Function End If .Text = CStr(CInt(TextX)) End With End Function
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.