<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Samet Kilictas's Blog &#187; C#</title>
	<atom:link href="http://samet.kilictas.com/tag/csharp-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://samet.kilictas.com</link>
	<description>Personal E-Notebook</description>
	<lastBuildDate>Fri, 30 Apr 2010 07:29:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Tutorial #3 &#8211; Pizza Order in C#</title>
		<link>http://samet.kilictas.com/tutorial-in-c-sharp-checkbox-radiobutton-order-pizza/</link>
		<comments>http://samet.kilictas.com/tutorial-in-c-sharp-checkbox-radiobutton-order-pizza/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 08:39:04 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Checkbox]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[Radiobutton]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=87</guid>
		<description><![CDATA[Here is my new pizza order tutorial for you. In this tutorial you are able to control checkboxes and radiobuttons together and show them into a message box window. Codes below&#8230; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class pizza : [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my new pizza order tutorial for you. In this tutorial you are able to control checkboxes and radiobuttons together and show them into a message box window.</p>
<p><a href="http://samet.kilictas.com/wp-content/uploads/2008/11/pizza.jpg"><img class="alignnone size-medium wp-image-88" title="pizza" src="http://samet.kilictas.com/wp-content/uploads/2008/11/pizza-300x180.jpg" alt="" width="300" height="180" /></a></p>
<p>Codes below&#8230;</p>
<pre class="brush: csharp">
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
public partial class pizza : Form
{

//Some global strings to keep radiobutton and checkbox events text&#039;s.
private String a1 = null;
private String a2 = null;
private String a3 = null;
private String menu = null;

public pizza()
{
InitializeComponent();
}
</pre>
<p><span id="more-87"></span></p>
<pre class="brush: csharp">

private void button1_Click(object sender, EventArgs e)
{

// This event for new order button, so it makes everything null.
textBox1.Text = null;
textBox2.Text = null;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
}

private void button3_Click(object sender, EventArgs e)
{
Application.Exit(); // it used for exit button
}

private void button2_Click(object sender, EventArgs e)
{
String name = textBox1.Text;
String surname = textBox2.Text;

MessageBox.Show(&quot;Name: &quot; + name + &quot;\nSurname: &quot; + surname + &quot;\nMenu: &quot; + menu + &quot;\nAdditions:&quot; + a1 + a2 + a3, &quot;Confirm Your Order!&quot;, MessageBoxButtons.YesNo ,MessageBoxIcon.Information);

}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
a1 = &quot; Mushroom&quot;;
}
else
{
a1 = null;
}
}

private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
a2 = &quot; Olive&quot;;
}
else
{
a2 = null;
}
}

private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
{
a3 = &quot; Corn&quot;;
}
else
{
a3 = null;
}
}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
menu = &quot;Classic&quot;;
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
menu = &quot;Full&quot;;
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
menu = &quot;Vegeterian&quot;;
}
}
}</pre>
<p>Any questions ?</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/tutorial-in-c-sharp-checkbox-radiobutton-order-pizza/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tutorial #2 &#8211; Basic Guess Game in C#</title>
		<link>http://samet.kilictas.com/basic-guess-game-in-c-sharp/</link>
		<comments>http://samet.kilictas.com/basic-guess-game-in-c-sharp/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 18:14:03 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Enter Key Handling]]></category>
		<category><![CDATA[MessageBox.Show]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Random Function]]></category>
		<category><![CDATA[Textfield]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=83</guid>
		<description><![CDATA[Here is my new tutorial for you about C#. In this tutorial i am going to make a little game about guessing result of some number summation, multiplation, division and addition. And i am going to focus on handling the enter keypress event for textfield. Here as you see from the screenshot of the main [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my new tutorial for you about C#. In this tutorial i am going to make a little game about guessing result of some number summation, multiplation, division and addition. And i am going to focus on handling the enter keypress event for textfield.</p>
<p><a href="http://samet.kilictas.com/wp-content/uploads/2008/11/guessgame.jpg"><img class="alignnone size-medium wp-image-84" title="Game Window" src="http://samet.kilictas.com/wp-content/uploads/2008/11/guessgame-300x269.jpg" alt="" width="300" height="269" /></a></p>
<p>Here as you see from the screenshot of the main window a user should guess the result of this operation. Textbox1 equals the random number &#8220;96&#8243;, textbox2 equals the random number &#8220;73&#8243; and there is an randomly operator which is &#8220;-&#8221; . User should guess this result and should write down the guess into the textbox3 field. When user press enter button textbox3 handles this event.</p>
<pre class="brush: csharp">
private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13) //Char 13 handles the enter key
{
Console.WriteLine(total);  //Here i can check the result from console for testing purposes
if (total.ToString() == textBox3.Text)
{
StringBuilder dogru_str = new StringBuilder();
dogru_str.Append(textBox1.Text);
dogru_str.Append(&quot; &quot; + label1.Text + &quot; &quot;);
dogru_str.Append(textBox2.Text + &quot; = &quot;);
dogru_str.Append(total + &quot;\n&quot;);
dogru_str.Append(&quot;Your answer was correct...&quot;);
MessageBox.Show(dogru_str.ToString(), &quot;Result&quot;, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);</pre>
<p><span id="more-83"></span></p>
<p>Here dogru_str keeps the new string. Then  i am able to send this paramater to MessageBox.Show</p>
<pre class="brush: csharp">
wins += 1; //Here i can show that how many times user wins
label4.Text = wins.ToString();
textBox3.ReadOnly = true;
}
else
{
StringBuilder yanlis_str = new StringBuilder();
yanlis_str.Append(textBox1.Text);
yanlis_str.Append(&quot; &quot; + label1.Text + &quot; &quot;);
yanlis_str.Append(textBox2.Text + &quot; = &quot;);
yanlis_str.Append(total + &quot;\n&quot;);
yanlis_str.Append(&quot;Your answer was wrong.!!&quot;);
MessageBox.Show(yanlis_str.ToString(), &quot;Result&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error);
loses += 1;
label5.Text = loses.ToString();
textBox3.ReadOnly = true;
}
}
}  </pre>
<p>After pressing enter button it determines if it is wrong answer or not. Then user should press replay button the replay the game.</p>
<p>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/basic-guess-game-in-c-sharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial #1 &#8211; Random Function in C#</title>
		<link>http://samet.kilictas.com/tutorial-random-function-in-c/</link>
		<comments>http://samet.kilictas.com/tutorial-random-function-in-c/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 21:05:50 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Random Function]]></category>
		<category><![CDATA[Switch]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=78</guid>
		<description><![CDATA[Since there are some other ways as well. Here is my little function which can generate a random integer private int RandomNumber(int min, int max) { Random random = new Random(); int rand = random.Next(min, max); return rand; } I need to convert this interger number to a string. And this function takes to parameters [...]]]></description>
			<content:encoded><![CDATA[<p>Since there are some other ways as well. Here is my little function which can generate a random integer</p>
<pre class="brush: csharp">
private int RandomNumber(int min, int max)
{
Random random = new Random();
int rand = random.Next(min, max);
return rand;
}</pre>
<p>I need to convert this interger number to a string. And this function takes to parameters minimum &amp; maximum. That helps you to determine the interval of this random numbers.</p>
<pre class="brush: csharp">
//Determine about operator
String[] operators = { &quot;+&quot;, &quot;-&quot;, &quot;/&quot;, &quot;*&quot; };
int rand3 = random.Next(1, 5);
//Console.WriteLine(rand3.ToString());
switch (rand3.ToString())
{
case &quot;1&quot;:
label1.Text = &quot;+&quot;;
total = rand1 + rand2;
break;
case &quot;2&quot;:
label1.Text = &quot;-&quot;;
total = rand1 - rand2;
break;
case &quot;3&quot;:
label1.Text = &quot;/&quot;;
total = rand1 / rand2;
break;
case &quot;4&quot;:
label1.Text = &quot;*&quot;;
total = rand1 * rand2;
break;
default:
label1.Text = &quot;Error&quot;;
break;
}
</pre>
<p><span id="more-78"></span><br />
Here i put a switch as an example. It gives me a random number and then i am able to get a random char from my string array.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/tutorial-random-function-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
