iT邦幫忙

1

C# 練習題目的小問題

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Square.sln
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DialogResult dr;    
            string i;           
            double num;         
            do
            {
                i = Microsoft.VisualBasic.Interation.InputBox
                    ("請輸入數值:", "求平方");
                num = Convert.ToDouble(i);     
                dr = MessageBox.Show(i + "的平方等於" + (num * num).ToString() +
                    "\n是否繼續?", "平方", MessageBoxButtons.YesNo);
            } while (dr == DialogResult.Yes);       
            Application.Exit();    
        }
    }
}

這裡紅線的Interation錯誤是指不要用還是不能用還是其他意思,只有查到避免名稱衝突這樣類似的答案,但還是不明白
https://ithelp.ithome.com.tw/upload/images/20220627/201483516G8YoQUFtp.jpg

YoChen iT邦研究生 1 級 ‧ 2022-06-27 16:52:51 檢舉
Interation拼錯了,請修改為Interaction~
orga_an21 iT邦新手 5 級 ‧ 2022-06-27 21:02:29 檢舉
感謝提醒
marlin12 iT邦研究生 5 級 ‧ 2022-06-29 19:53:25 檢舉
Windows.Forms已經過時,微軟快將不支持,也存在不少的問題(例如:DPI scaling)。現在應該學習UWP和XAML。
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

3
Homura
iT邦高手 1 級 ‧ 2022-06-27 16:50:24
最佳解答

錯誤有說你少了組件
所以把Microsoft.VisualBasic組件加入參考就能使用了

https://ithelp.ithome.com.tw/upload/images/20220627/20109839ncOWCSELTN.png

orga_an21 iT邦新手 5 級 ‧ 2022-06-27 17:07:40 檢舉

這畫面我之前用過別的東西現在突然要開找不到在哪耶,可以提供一下去哪裡開嗎? 感謝你

Homura iT邦高手 1 級 ‧ 2022-06-27 17:09:12 檢舉

orga_an21
方案總管對專案右鍵
第一個選項
https://ithelp.ithome.com.tw/upload/images/20220627/20109839dzOBSLCPWZ.png

orga_an21 iT邦新手 5 級 ‧ 2022-06-27 17:14:31 檢舉

太感謝你了

0
allenlwh
iT邦高手 1 級 ‧ 2022-06-27 17:03:29
orga_an21 iT邦新手 5 級 ‧ 2022-06-27 17:14:18 檢舉

感謝你

我要發表回答

立即登入回答