作者A1pha ([αλφα])
看板Visual_Basic
標題[VB6 ] 請問要怎麼判斷對方輸入的資料的型態?
時間Tue Jan 9 18:08:47 2007
請問,
要怎麼判斷對方輸入在TXT裡面的東西是數字還是文字啊?
我寫了一個程式,要求對方在文字框中輸入一些數字,
假使數字不對我還知道怎麼判斷,
但是假使對方輸入文字的話,
我該怎麼判斷啊?
本來想說,用val(text1.text)來判斷,假使是0的話,表示對方有可能輸入文字,
但是,這樣也有錯,
假使我要設計的問題中,也要輸入0的話,就無法分辨對方輸入的是文字 還是 0。
看書學的,所以問題很爛QQ
感謝解答
--
"Every kid who has dreamed of being a baseball player has stood in his front
yard with a bat and said to himself, "Bottom of the ninth, Game 7 of the
World Series, the bases are loaded," and then envisioned hitting a home run
to win the game. My job is to shatter that dream."
By Huston Street
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.8.97.84
推 ckndim:用"IF 判斷式 Then"來做吧 01/09 18:23
推 A1pha:問一下,判斷式裡面要寫啥? 就是不知道怎麼判斷QQ 01/09 18:29
推 BearWu:檢查ASCII碼吧 01/09 18:30
推 A1pha:我看z--12--4--1--21 裡面有個Asc(Mid(s, i, 1)) 01/09 18:33
→ A1pha:是用這個吧?@@" 01/09 18:35
推 A1pha:喔喔! 剛剛查了一下 現在會用了~ 感謝XD 01/09 18:52
推 fumizuki:IsNumeric(.......) 01/09 19:53
推 A1pha:喔喔!! 感謝樓上XD 我來試試看~ 01/09 20:44
推 A1pha:這個真方便QQ 謝謝板大XD 也感謝三樓,順便學了兩個函式 01/09 20:46