用VF怎麼做簡易計算器啊,VF編寫簡易計算器

2021-08-13 22:50:15 字數 4575 閱讀 6207

1樓:匿名使用者

你在計算按鈕上雙擊,在其click事件中輸入**a=thisform.text1.valueb=thisform.

text2.valuen=thisform.optiongroup1.

valuedo  case

case  n=1

thisform.text3.value=a+bcase  n=2

thisform.text3.value=a-bcase  n=3

thisform.text3.value=a*bcase  n=4

thisform.text3.value=a/bendcase

thisform.refresh

2樓:

設計步驟如下(借鑑):

(1)建立應用程式使用者介面。

選擇“新建”表單,進入表單設計器,增加一個文字框控制元件textl、一個標籤控制元件label1和一個命令按鈕組commandgroup1,並將命令按鈕組的buttoncount屬性改為16。

(2)設定物件屬性如下表所示:

commandgroup1中各按鈕的屬性設定

物件 屬性 屬性值 說明

command1~command10 caption 依次改為:1、2、3、4、5、6、7、8、9、0

fontbold .t.

command11~command10 caption 依次改為:.、=、+、-、*、/

fontbold .t.

(3)編寫程式**。

①編寫commandgroup1的click事件**:

if thisform.tag=.t.

thisform.text1.value=allt(right(str(this.value),1))

thisform.tag=〃 〃

else

a=thisform.text1.value

thisform.text1.value=a+allt(right(str(this.value),1))

endif

②編寫“.”按鈕command11的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃.〃

③編寫“=”按鈕command12的click事件**:

a=thisform.text1.value

thisform.tag=.t.

④編寫“+”按鈕command13的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

⑤編寫“-”按鈕command14的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃-〃

thisform.tag=〃 〃

⑥編寫“*”按鈕command15的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃*〃

thisform.tag=〃 〃

⑦編寫“/”按鈕command16的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

vf編寫簡易計算器

3樓:

設計步驟如下(借鑑):

(1)建立應用程式使用者介面。

選擇“新建”表單,進入表單設計器,增加一個文字框控制元件textl、一個標籤控制元件label1和一個命令按鈕組commandgroup1,並將命令按鈕組的buttoncount屬性改為16。

(2)設定物件屬性如下表所示:

commandgroup1中各按鈕的屬性設定

物件 屬性 屬性值 說明

command1~command10 caption 依次改為:1、2、3、4、5、6、7、8、9、0

fontbold .t.

command11~command10 caption 依次改為:.、=、+、-、*、/

fontbold .t.

(3)編寫程式**。

①編寫commandgroup1的click事件**:

if thisform.tag=.t.

thisform.text1.value=allt(right(str(this.value),1))

thisform.tag=〃 〃

else

a=thisform.text1.value

thisform.text1.value=a+allt(right(str(this.value),1))

endif

②編寫“.”按鈕command11的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃.〃

③編寫“=”按鈕command12的click事件**:

a=thisform.text1.value

thisform.tag=.t.

④編寫“+”按鈕command13的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

⑤編寫“-”按鈕command14的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃-〃

thisform.tag=〃 〃

⑥編寫“*”按鈕command15的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃*〃

thisform.tag=〃 〃

⑦編寫“/”按鈕command16的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

4樓:咎蘿醜山彤

簡單的計算器吧

通過鍵盤輸入數

實現+-

*/功能

在表單裡建

六個命令按鈕+-

*/=c(清零)

一個文字框

寫**右鍵

**對form1初始化

過程為init

public

a,b,c,d

d=0文字框**

text1

過程lostfocus

c=thisform.text1.value命令按鈕+(command1)

過程click

a=cc='0'

thisform.text1.value=cb='+'

命令按鈕-(command2)

過程同上

a=cc='0'

thisform.text1.value=cb='-'

乘法的a=c

c='0'

thisform.text1.value=cb='*'

除法的a=c

c='0'

thisform.text1.value=cb='/'

等號的if

b='+'

d=val(a)+val(c)

c=str(d)

thisform.text1.value=dendif

ifb='-'

thisform.text1.value=val(a)-val(c)endif

ifb='*'

thisform.text1.value=val(a)*val(c)endif

ifb='/'

thisform.text1.value=val(a)/val(c)endif

清零的thisform.text1.value='

'完成了不知道好使不

如何利用巨集替換函式在vf裡製作簡易計算器

5樓:匿名使用者

1.建表單

2.建2個文

du本框 text1,text2

3.建1個命令按鈕

zhidao command1

4.在表單版 init 中寫入權:

thisform.text2.value = 05. 在命令按鈕 command1 的 click 中寫入:

local ccmd

ccmd = "thisform.text2.value = " + alltrim(thisform.text1.value)

&ccmd

6.執行表單

7.在 text1 中輸入 1+2*3/4+(5+6)+7^88.按 command1 按鈕

9.text2 中顯示結果 5764814.50

計算器怎麼做

1 首先,新建一個文字檔案,命名為 計算器。txt 你也可以命名為其他的,但是不能沒有字尾 txt 2 雙擊開啟,進入記事本,初次使用記事本,先熟悉一下介面,白色的區域是區,最上方有標題,標題和區中間有工具欄,這個介面的最下方是狀態。3 這一步很重要,需要輸入一些 4 最後一步,在狀態列確定一下有沒...

用C製作科學計算器,如何用C 編寫簡易計算器

用指令碼引擎實現吧,把你要計算的內容轉化為指令碼 你 或者 我 都做出來了,還要微軟幹嘛。去51aspx找原始碼唄 如何用c 編寫簡易計算器 你要做什麼樣的計算器?如何用c 製作計算器啊?兄弟 感覺和你有種似曾相識的感覺 你成都的?建議你去找本參考書慢慢看!用c 做一個計算器怎麼做?你學過別的程式語...

ENKO計算器中如何求,計算器的X怎麼用啊?謝謝幫忙

對於一般的雙行顯示的科學計算器,按 rcl 變數 後,上行會顯示a 統計模式中是 x的平方 下行直接顯示結果。對於單行的計算器,輸入 rcl 變數 後會直接顯示結果。統計模式中,x的平方 的值會代入變數a,所以按 rcl 變數a所在的按鍵 會直接顯示平方和。是不需要單獨輸入 a 的。計算器的 x 怎...