<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>grifolaのブログ</title>
<link>https://ameblo.jp/grifola/</link>
<atom:link href="https://rssblog.ameba.jp/grifola/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>ブログの説明を入力します。</description>
<language>ja</language>
<item>
<title>ダイアログボックス表示</title>
<description>
<![CDATA[ <div>&nbsp;DialogResult dr = MessageBox.Show("あなたは日本出身ですか？","国籍確認",MessageBoxButtons.YesNo);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (dr == DialogResult.Yes)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("えっ");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("^^;");<br><br>あなたは日本出身ですか？　という質問に対して<br>はいを押すとえっと表示<br>いいえを押すと＾＾；　と表示されるプログラム。<br><br>DialogResult dr = MessageBox.Show("あなたは日本出身ですか？","国籍確認",MessageBoxButtons.YesNo);<br><br>DialogResult　dr　　これは　はいかいいえを確認するために必要みたいです。<br>dr　は　勝手につけただけ　自由。<br><br>("あなたは日本出身ですか？","国籍確認",MessageBoxButtons.YesNo);<br><br>１つ目の””がテキスト　2つ目の””が題<br>最後のがメッセージボックスに、はい　いいえをつけるおまじない<br><br><span style="color: rgb(255, 0, 0);">&nbsp;DialogResult ○○ = MessageBox.Show("テキスト","題",ボタンの種類);<br></span><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F716b8902e3e3f57c5dfdd0c996a29582.png%3F1364856447" id="gyazo_img"><br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F9a7bbc9a8425576248d572066fe3de2d.png%3F1364856460" id="gyazo_img"><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F3ea5f39384c3625a2fc60ca13969cf9c.png%3F1364856465" id="gyazo_img">　　　　　<img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F5bf317610173639fae59d5e4e5e243ff.png%3F1364856473" id="gyazo_img" style="line-height: 1.5;"><br></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11503099400.html</link>
<pubDate>Tue, 02 Apr 2013 07:42:18 +0900</pubDate>
</item>
<item>
<title>コメントアウト</title>
<description>
<![CDATA[ <div>{<br>int x = 1;</div><div>&nbsp;//int x = 2;</div><div>MessageBox.Show(""+x);<br>}<br><br>コメントアウトとは、先頭に//をつけることによって<br>//のついた行をプログラム上から無視できる機能です。<br>上のコードを実行するとメッセージボックスに１と表示されます。<br><br>自分用のメモや、ここの仕組みがどうなっているかを簡単に説明したりと<br>非常に便利です。<br>最も、わかりやすいコードを書くのが一番です。<br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2Fe72e908d57fb2e1cfa15af8ae490b778.png%3F1364764581" id="gyazo_img" style="line-height: 1.5;"><br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F1c4ae06f9894007e09ab32d69496d0f3.png%3F1364764594" id="gyazo_img" style="line-height: 1.5;"></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502345214.html</link>
<pubDate>Mon, 01 Apr 2013 06:14:55 +0900</pubDate>
</item>
<item>
<title>入力した数値を計算してメッセージボックスに表示</title>
<description>
<![CDATA[ <div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x = int.Parse(textBox1.Text);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int y = int.Parse(textBox2.Text);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("あなたが入力した文字を合計すると"+(x+y)+"になります。");<br>　　　　}<br><br><div>&nbsp; 　　　　　int x = int.Parse(textBox1.Text);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int y = int.Parse(textBox2.Text);　について。<br><br>int x , int y に　テキストボックスのテキストを入れるのですが、<br>テキストボックスのテキストはあくまでテキスト、つまり文字なので<br>それを数値に直さなければいけません。<br><br>int.Parse(　)　は文字化した数値を数字に戻すことができる効果があります。<br>これをつけないと、上のコードを実行すると<br><br>あなたが入力した文字を合計すると111222になります。　になります。<br>数値が文字のままなので、単にくっつけられるだけです。<br><br>ただ、このプログラムには欠陥があって、<br>文字が入力された場合、フリーズします。<br>というのも、このintという変数(カゴ)は整数だけを格納できる物だからです。<br>整数しか入らないカゴに文字を入れることは不可能です、それでフリーズします。<br><br>では、どうやったらフリーズしないかというと、<br><br>・・・私はまだわかりません＠＠；<br>これから勉強していくつもりです。<br>現状での対策としては、<br>ラベルコントロールを配置して<br>注意書きを書いとくとかです。<br><br><br><br></div><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F09944e85e54ddf5c33376ee4888c71b7.png%3F1364763584" id="gyazo_img" title="" alt=""><br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F1e789839c0319e1e7a00f6877caea83a.png%3F1364763601" id="gyazo_img"><br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F212aa9f493033a72e19690e9de0f2121.png%3F1364763606" id="gyazo_img"><br><br><br><br></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502344055.html</link>
<pubDate>Mon, 01 Apr 2013 06:00:44 +0900</pubDate>
</item>
<item>
<title>入力した文字をメッセージボックスに表示する</title>
<description>
<![CDATA[ <div><span style="line-height: 1.5;">　　　 &nbsp; {</span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string text = textBox1.Text;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("あなたがテキストボックスに入力した文字は"+text+"です。");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }<br><br>新しくテキストボックスコントロールを表示します。<br>buttonの出し方が分かる人はわかると思いますが、<br>ツールボックス→TextBox　です。<br><br><br>&nbsp;string text = textBox1.Text;　まずはこの文から。<br><br>string　というのは　int　と似たようなもので、<br>これは文字だけを格納することができます。<br>stringに数字を入れる事は可能ですが、<br>その場合は文字として認識させないといけないので<br>""をつけないといけません。<br><br><br>例<br>○　string　number　=　”12”；<br>☓　string　number　=１２；<br><br>話を戻しますが、&nbsp;string text = textBox1.Text;　　は<br>textという文字を格納できるカゴに　textBox1.Text（テキストボックス１のテキスト）を代入するということです。<br><br><br><br><br><br>&nbsp;<img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2Fb9654f618035174ec7e228663c8c2178.png%3F1364760846" id="gyazo_img" style="line-height: 1.5;"><span style="line-height: 1.5;">&nbsp;<br></span><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F7d1c19599e827f354e78fa1073bd08af.png%3F1364760863" id="gyazo_img" style="line-height: 1.5;"><span style="line-height: 1.5;">&nbsp;&nbsp;<br></span><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2Fa3fe300c5e3032c6c6614f73448343bb.png%3F1364760870" id="gyazo_img" style="line-height: 1.5;"></div><div><br></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502337231.html</link>
<pubDate>Mon, 01 Apr 2013 05:12:12 +0900</pubDate>
</item>
<item>
<title>反復処理</title>
<description>
<![CDATA[ <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int x = 1; x &lt;= 10; ++x)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show( x + "回表示しました。");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>えらいすっきりしていますが、処理としては少しだけ複雑です。<br><br>まず<br>&nbsp; for (int x = 1; x &lt;= 10; ++x)　の部分。<br><br><br>int x = 1; はとりあえず置いといて、　真ん中の<br>ｘ　&lt;=10　;　から。<br>これは　x　が10以下の時に実行するという意味です。<br><br>んで右側の++x　は　xに++(+1）するという意味。<br>プログラムの世界では+1を++と書くのが一般的です。<br>++xで　xに1を加えます。<br>最後に左側の　int x = 1;&nbsp;<br>これはxの初期の値が１ということです。<br><br>このfor文は　真ん中の条件式を満たさなくなるまで処理が続くので<br>xの値と条件が小さいほど処理の回数がヘリます。<br><br>&nbsp;for (int x = 1; x &lt;= 10; ++x)　だと<br>１からスタートして　１０回処理をしたらやめるという感じです。<br><br><div><br></div>流れとしては、<br><br>ｘ＝１　→条件に当てはまってる→処理実行→ｘに１を足す<br>ｘ＝2　→条件に当てはまってる→処理実行→ｘに１を足す<br>・<br>・・<br>ｘ＝１0　→条件に当てはまってる→処理実行→ｘに１を足す<br>ｘ＝１1　→条件に当てはまってない→終わり<br><br>最初に紹介したこのコードだと<br><div>&nbsp; for (int x = 1; x &lt;= 10; ++x)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show( x + "回表示しました。");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>buttonをクリックすると</div>1回表示しました。<br>2回表示しました。<br>・<br>・・<br>10回表示しました。　で終わりです。<br><br><br><span style="color: rgb(255, 0, 0);">for　（初期化式；条件式；更新式）<br>　　　｛<br>　　　　　　　実行したいコード<br>　　　｝　<br><br></span><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F816dba81cb7f8857f915f2300019c42e.png%3F1364759570" id="gyazo_img"><span style="color: rgb(255, 0, 0);"><br></span></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502335267.html</link>
<pubDate>Mon, 01 Apr 2013 04:52:59 +0900</pubDate>
</item>
<item>
<title>　ｉｆ文</title>
<description>
<![CDATA[ <div>MessageBox.Show("変数xの値が5以下なら「ごみ」、6以上なら「素晴らしい」と表示します。");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x = 10;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (x &gt;= 6)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("素晴らしい");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("ごみ");<br><br><br>変数ｘの値は１０です。2行目をみてみるとわかります<br><br>んで次にでているのが　<span style="line-height: 1.5;">&nbsp;</span><span style="line-height: 1.5;">if (x &gt;= 6)　という謎の文字列。<br><br>if　は英語でも使うように、「もし～ならば」という意味。<br>プログラムの場合はifの後ろに条件（もし～ならばの　～に当たる部分）を書いて<br>その後に何が起こるかを書きます。<br><br></span><div>&nbsp; if (x &gt;= 6)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("素晴らしい");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("ごみ");</div><span style="line-height: 1.5;">このコードを訳すと、<br>「もし x &gt;= 6 （ｘが6以上）なら素晴らしいと表示し、else（それ以外）ならごみと表示します」となります。<br><br>( x &gt;= 6 )　は　ｘ ≧ 6　と同じ意味です。　&gt;=　は≧の事です。　ちなみに≦は&lt;=　です。<br><br>変数ｘは１０ですから、６以上です。つまり、素晴らしいと表示されるわけです。<br><br></span><div>&nbsp; 　　　　　{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("素晴らしい");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("ごみ");<br><br>この部分を見てみると　｛　｝　が付いているのがわかります。<br><br>これは、条件を満たしているなら｛｝の中のコードを実行するという事です。　<br>elseの下のコードも本当は｛　｝をつけるのですが、<br>｛｝の中のコードが１行だけだと｛｝をつけなくてもいいルールとなってます。<br><br><span style="color: rgb(255, 0, 0);">if（条件）<br>　　　　｛<br>　　　　　　　条件を満たしているならこの中のコードを実行<br>　　　　｝<br>else<br>　　　　｛<br>　　　　　　　満たしてなければこの中のコードを実行<br>　　　　｝</span></div><span style="line-height: 1.5;"><br><br></span><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2Fb7f8d55fccd3aa7bac6720eab9346948.png%3F1364757671" id="gyazo_img"><br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F3559e166c4ab2f51e5f92d6d41178fc5.png%3F1364758171" id="gyazo_img"><br><span style="line-height: 1.5;"><br><br></span><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F079e5c9e245737f31af5e408c0522dcc.png%3F1364758173" id="gyazo_img"><span style="line-height: 1.5;"><br></span></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502333070.html</link>
<pubDate>Mon, 01 Apr 2013 04:41:49 +0900</pubDate>
</item>
<item>
<title>内部計算</title>
<description>
<![CDATA[ <div>　　　　{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x = 100;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int y = 200;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("変数xの値は" + x + ",変数yの値は" + y );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("合計は" + (x + y));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }<br><br>一番目のメッセージボックスで<br>変数ｘの値は100(xというカゴの中に入っている数値は100だから）<br>変数ｙの値は200(yというカゴの中に入っている数値は200だから）<br>と表示される。<br><br>二番目のメッセージボックスで<br>合計は300　と表示される。<br>メッセージボックスの中でも計算は可能で、<br>変数ｘと変数ｙを足すと　変数xyになるのではなく、<br>ｘの中身＋ｙの中身、つまり１００＋２００になって３００になる。<br><br>ちなみに<span style="line-height: 1.5;">&nbsp; MessageBox.Show("合計は" + (x + y));　とあるが、<br></span>&nbsp; MessageBox.Show("合計は" + x + y);<br><span style="line-height: 1.5;">としてしまうと　合計は100200と表示されてしまう。<br>というのも「合計は」というのは文字で、　１００　というのは数字。<br>数学、算数では計算は左から優先されるので　文字＋数字になってしまう。<br><br><br>なので（）をつけて（）内を先に計算するようにしている。<br><br></span><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2Fb7f8d55fccd3aa7bac6720eab9346948.png%3F1364757671" id="gyazo_img"><br><span style="line-height: 1.5;"><br></span><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F246e6311628e80c74aec5f285dde7a15.png%3F1364757685" id="gyazo_img"><br><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F861ffca22832c3599f9e66db15c8ef67.png%3F1364757685" id="gyazo_img" style="line-height: 1.5;"><span style="line-height: 1.5;"><br></span></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502330507.html</link>
<pubDate>Mon, 01 Apr 2013 04:12:48 +0900</pubDate>
</item>
<item>
<title>Hello world！</title>
<description>
<![CDATA[ <div>&nbsp;private void button1_Click(object sender, EventArgs e)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show("Hello World!");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div><img style="-webkit-user-select: none" src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F4fc2ee5d7f21d81af136b65aa9c9e09a.png%3F1364754536"><br></div><div>↓</div><div><img style="-webkit-user-select: none" src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F948abd2a20a022c356ebd85edaf2d7d6.png%3F1364754539"><br></div><div><br></div><div>コンソールは既に覚えたような、覚えていないような感じなので割愛。</div><div>button１を押すとHello world！と表示されるプログラム。</div><div><br></div><div>&nbsp;MessageBox　.　Show　("　Hello World!")　;</div><div><br></div><div>MessageBox.showでMessageBox（メッセージボックス）をShow（表示）</div><div>Showの中身はHello world!、つまりHello world！　を表示。</div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502329251.html</link>
<pubDate>Mon, 01 Apr 2013 04:08:04 +0900</pubDate>
</item>
<item>
<title>変数について</title>
<description>
<![CDATA[ <div>private void button1_Click(object sender, EventArgs e)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 10;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(""+i);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div><br></div><div>Visual Studioで自動的に生成される部分は除外。</div><div>button１をクリックすると画面に「１０」と表示されるプログラム。</div><div><br></div><div>int　i　と書くと　iという名前のカゴの中に整数(int)を入れれる状態になる。</div><div>int　i　=　10;　こう書くと　iという名前のカゴの中に[10]という数値を入れることができる。</div><div><br></div><div>それをメッセージボックスでShow（表示）する。</div><div>&nbsp; MessageBox.Show(""+i);　Showの中身は(""+i)。</div><div>　""の中に表示したい文字を入れて　+　i　で</div><div>文字の後にさっき作ったiのカゴの中身表示する。</div><div><br></div><div>&nbsp;MessageBox.Show("私の家の電話番号は1"　+　i　+　"です。");</div><div>と書けば　button１を押した時に　「私の家の電話番号は110です。」と表示される。</div><div><br><img src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2F94dd1d9c2481e6d839d51c4ac74ae935.png%3F1364755067"><br>↓</div><div><img style="-webkit-user-select: none" src="https://img-proxy.blog-video.jp/images?url=http%3A%2F%2Fgyazo.com%2Fbeb3b020008c08467aa526dce61c588c.png%3F1364755086"><br></div><div><br></div><br>
]]>
</description>
<link>https://ameblo.jp/grifola/entry-11502329288.html</link>
<pubDate>Mon, 01 Apr 2013 04:06:17 +0900</pubDate>
</item>
</channel>
</rss>
