tag:blogger.com,1999:blog-10978231409410689292024-03-06T02:48:20.811+05:30Software Programming and PC TricksSoftware Programming and PC TricksSoftsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.comBlogger52125tag:blogger.com,1999:blog-1097823140941068929.post-40378506689566380172014-05-27T22:41:00.000+05:302014-05-27T22:57:32.865+05:30Sound Recorder in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP_wUPgSykj6LEMfy5ZobyjqftNHU3H_qk2Qw3Pfj3uGDC6mRHjsF-USUdk_4Rspu-FG_omi-AxxF4sdXwG7325ID8_mBoCpigxEeKMZ_4yoMpHRiR-Tl6OEa6yHErc4ZzSGFJUf_mUUYd/s1600/Design.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP_wUPgSykj6LEMfy5ZobyjqftNHU3H_qk2Qw3Pfj3uGDC6mRHjsF-USUdk_4Rspu-FG_omi-AxxF4sdXwG7325ID8_mBoCpigxEeKMZ_4yoMpHRiR-Tl6OEa6yHErc4ZzSGFJUf_mUUYd/s1600/Design.png" height="148" width="320" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hello Programmer,</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you are going to create a<i> Sound Recorder in C#</i>. The Recorded sound will be saved in<i> .wav </i>format. So let's start;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="background-color: white; line-height: 20.799999237060547px;"><b>Steps</b></span><br style="background-color: white; line-height: 20.799999237060547px;" /><span style="background-color: white; line-height: 20.799999237060547px;"><b><br /></b></span><span style="background-color: white; line-height: 20.799999237060547px;"></span><span style="background-color: white; line-height: 20.799999237060547px;">1. Open <b><i>Visual Studio</i></b> -> <b><i>New Project</i></b> -> <b><i>Windows Form Application</i></b> with name</span><br style="background-color: white; line-height: 20.799999237060547px;" /><span style="background-color: white; line-height: 20.799999237060547px;"> <i><b>SoundRecorder.</b></i></span><br style="background-color: white; line-height: 20.799999237060547px;" /><span style="background-color: white; line-height: 20.799999237060547px;"><br /></span><span style="background-color: white; line-height: 20.799999237060547px;"></span><span style="background-color: white; line-height: 20.799999237060547px;">2. Now add 3 buttons and a label to the empty form and design it as shown in </span><br style="background-color: white; line-height: 20.799999237060547px;" /><span style="background-color: white; line-height: 20.799999237060547px;"> the below screenshot.</span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP_wUPgSykj6LEMfy5ZobyjqftNHU3H_qk2Qw3Pfj3uGDC6mRHjsF-USUdk_4Rspu-FG_omi-AxxF4sdXwG7325ID8_mBoCpigxEeKMZ_4yoMpHRiR-Tl6OEa6yHErc4ZzSGFJUf_mUUYd/s1600/Design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP_wUPgSykj6LEMfy5ZobyjqftNHU3H_qk2Qw3Pfj3uGDC6mRHjsF-USUdk_4Rspu-FG_omi-AxxF4sdXwG7325ID8_mBoCpigxEeKMZ_4yoMpHRiR-Tl6OEa6yHErc4ZzSGFJUf_mUUYd/s1600/Design.png" height="185" width="400" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="background-color: white; line-height: 20.799999237060547px;"><br /></span></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="background-color: white; line-height: 20.799999237060547px;"><br /></span></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="background-color: white; line-height: 20.799999237060547px;">3. </span></span><span style="background-color: white; color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">Now change the name and text of the added controls from the Properties dialog box;</span><br />
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> <b>Control </b> <b>Control Name</b> <b>Text</b></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b> </b><i>Button1</i><b> </b><i>btnRecord Record</i></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i> </i></span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Button2</i><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </b><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">btnStopandSave Stop and Save</i></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </b><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Button3</i><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </b><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">btnPlay Play</i></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i> label1 label1 </i></span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Recording...</i></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><br /></i></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">4. Now double click on the <i>Record button </i>and copy the below code;</span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> label1.Visible = true;</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> mciSendString("open new type waveaudio alias Som", null, 0, 0);</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> mciSendString("record Som", null, 0, 0);</span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5. Now double click on the</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Stop and Save</i><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> button </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">and copy the below code;</span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> </span><span style="font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"><span style="color: #073763;"> </span><span style="color: #741b47;">label1.Visible = false;</span></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> mciSendString("pause Som", null, 0, 0);</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> SaveFileDialog save = new SaveFileDialog();</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> save.Filter = "wave|*.wav";</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> if (save.ShowDialog() == DialogResult.OK)</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> {</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> mciSendString("save Som " + save.FileName, null, 0, 0);</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> mciSendString("close Som", null, 0, 0);</span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"> }</span></span></div>
<div class="separator" style="background-color: white; clear: both; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #741b47;"> </span></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">6. Now double click on the</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Play </i><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">and copy the below code;</span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><span style="color: #741b47;"> if (record == "")</span></span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> OpenFileDialog open = new OpenFileDialog();</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> open.Filter = "Wave|*.wav";</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (open.ShowDialog() == DialogResult.OK) { record = open.FileName; }</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="background-color: white; clear: both; line-height: 20.799999237060547px;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> mciSendString("play " + record, null, 0, 0);</span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">7. </span><span style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;">Now</span><i style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </i><span style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;">double click on the</span><span style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><i style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Form</i><i style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </i><span style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;">and copy the below code;</span></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;">
<span style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="background-color: transparent; color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> </span><span style="color: #741b47;"><span style="background-color: transparent; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> </span><span style="background-color: transparent; line-height: 20.799999237060547px;"><span style="font-family: Trebuchet MS, sans-serif;">label1.Visible = false;</span></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="background-color: transparent; line-height: 20.799999237060547px;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="background-color: transparent; line-height: 20.799999237060547px;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">8. Now please update your code from the</span></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> complete code shown below;</span></div>
<span style="background-color: white; color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"><br /></span><span style="background-color: white; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;"></span><b style="background-color: white; color: #333333; font-family: Arial, serif; line-height: 20.799999237060547px;"><span style="color: #351c75; font-family: 'Trebuchet MS', sans-serif;">Form1.cs</span></b><br />
<div>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"><b><br /></b></span></span></div>
<div>
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"></span><br />
<div>
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;">using System;</span></span></div>
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">
</span>
<div>
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;">using System.Runtime.InteropServices;</span></span></div>
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">
<div>
<span style="line-height: 20.799999237060547px;">using System.Windows.Forms;</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;">namespace SoundRecorder</span></div>
<div>
<span style="line-height: 20.799999237060547px;">{</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> public partial class Form1 : Form</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> [DllImport("winmm.dll")]</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> private static extern int mciSendString(string MciComando, string MciRetorno, int MciRetornoLeng, int CallBack);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> string record = "";</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> public Form1()</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> InitializeComponent();</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> private void Form1_Load(object sender, EventArgs e)</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> label1.Visible = false;</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> private void btnRecord_Click(object sender, EventArgs e)</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> label1.Visible = true;</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> mciSendString("open new type waveaudio alias Som", null, 0, 0);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> mciSendString("record Som", null, 0, 0);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> private void btnStopandSave_Click(object sender, EventArgs e)</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> label1.Visible = false;</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> mciSendString("pause Som", null, 0, 0);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> SaveFileDialog save = new SaveFileDialog();</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> save.Filter = "wave|*.wav";</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> if (save.ShowDialog() == DialogResult.OK)</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> mciSendString("save Som " + save.FileName, null, 0, 0);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> mciSendString("close Som", null, 0, 0);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"><br /></span></div>
<div>
<span style="line-height: 20.799999237060547px;"> private void btnPlay_Click(object sender, EventArgs e)</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> if (record == "")</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> {</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> OpenFileDialog open = new OpenFileDialog();</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> open.Filter = "Wave|*.wav";</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> if (open.ShowDialog() == DialogResult.OK) { record = open.FileName; }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> mciSendString("play " + record, null, 0, 0);</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;"> }</span></div>
<div>
<span style="line-height: 20.799999237060547px;">}</span></div>
</span><br />
<div class="separator" style="background-color: white; clear: both;">
<span style="background-color: transparent; line-height: 20.799999237060547px;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></span></div>
</div>
<div class="separator" style="background-color: white; clear: both;">
<span style="background-color: transparent; line-height: 20.799999237060547px;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #351c75; line-height: 20.799999237060547px;">8. </span><span style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;">Rebuild and Run the project;</span></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">Click on Record to start Recording.</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> </span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">Recording label will be visible while sound is being recorded.</span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">Click on Stop and Save button to Save the Recording. You will be asked for the location and filename to Save.</span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">Now click on Play button to play the recorded file. You will have to select the file from the saved location.</span></li>
</ul>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;"> ENJOY Recording :-)</span></span><b style="color: #351c75; font-style: italic; line-height: 20.799999237060547px;"> </b></span><br />
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><b style="color: #351c75; font-style: italic; line-height: 20.799999237060547px;"><br /></b></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #351c75;"><b><i><br /></i></b></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #351c75;"><b>OUTPUT</b></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #351c75;"><b><br /></b></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwpXtsEZ2xz6lHl6E-BGINTIBGWZHLHd1HGD7cYkp1rLiIGUej2ckIv8sjZag9WHVvrvqKsh714AzWiQ5uSUHtq_XyT9IZLgzUUZ15r6WOAVOg5MFeIyZebYx4rVQNTfs9hcOyZs2cDn06/s1600/Sound+Recorder.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwpXtsEZ2xz6lHl6E-BGINTIBGWZHLHd1HGD7cYkp1rLiIGUej2ckIv8sjZag9WHVvrvqKsh714AzWiQ5uSUHtq_XyT9IZLgzUUZ15r6WOAVOg5MFeIyZebYx4rVQNTfs9hcOyZs2cDn06/s1600/Sound+Recorder.png" height="168" width="400" /></a></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #351c75;"><b><br /></b></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #351c75;"><b><br /></b></span><b style="color: #351c75; font-style: italic; line-height: 20.799999237060547px;"><br /></b><span style="color: #333333; line-height: 20.799999237060547px;"></span><b style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;">Conclusion</span></b><br style="color: #333333; line-height: 20.799999237060547px;" /><b style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;"><br /></span></b><span style="color: #333333; line-height: 20.799999237060547px;"></span><span style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;">In case of any doubts / errors, please drop in a comment.</span></span><br style="color: #333333; line-height: 20.799999237060547px;" /><span style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;"><br /></span></span><span style="color: #333333; line-height: 20.799999237060547px;"></span><span style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;"><br /></span></span><span style="color: #333333; line-height: 20.799999237060547px;"></span><span style="color: #333333; line-height: 20.799999237060547px;"><span style="color: #073763;"><b>See Also</b></span></span></span></div>
<div class="separator" style="background-color: white; clear: both;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"><a href="http://softsprogrammer.blogspot.in/2014/05/how-to-start-and-kill-process-in-c.html">How to Start and Kill a Process in C#</a></span></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 20.799999237060547px;"><a href="http://softsprogrammer.blogspot.in/2014/01/create-batch-file-timer.html">Create a Batch File Timer</a></span></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html">WCF Tutorial for Beginners</a></span></li>
</ul>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-53067064137499603342014-05-22T21:41:00.000+05:302014-05-27T22:57:20.707+05:30Text to Speech in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>Hello Programmers</i>,</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUqqe0CWb0ytbKdl0WGJvDuMc457fNDAtZzTTWaPTD8XWGwDl04Ryiie-jku9t8Pa7bBO8b0HYM0H596wuQQ2sWEeItaIEYf4AP6_KOK82uEMoz2XDTIaqR-yeQ2HKDWGKWqv7f62gzU7V/s1600/Text+to+Speech.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUqqe0CWb0ytbKdl0WGJvDuMc457fNDAtZzTTWaPTD8XWGwDl04Ryiie-jku9t8Pa7bBO8b0HYM0H596wuQQ2sWEeItaIEYf4AP6_KOK82uEMoz2XDTIaqR-yeQ2HKDWGKWqv7f62gzU7V/s1600/Text+to+Speech.png" /></a></span></div>
<br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you are gonna learn how to convert <i>Text to Speech in C#</i> i.e you are going to create a software that <b>Talks!</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">So lets start;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b></b></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <b><i>Visual Studio</i></b> -> <b><i>New Project</i></b> -> <b><i>Windows Form Application</i></b> with name</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i><b>TexttoSpeech.</b></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now add button, richtextbox and labels to the empty form and design it as shown in </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the below screenshot.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6rUjnM9y1Dqr0_-3kKeYfpwwNg9tzcxQsgOYTwIJkpi0QZ7W_pEMmfumgI8VPFTmWJxuI_GkU-JnebncO-YTqRCDiChPNHAL0kaxTqMuicr2dqBVoOh1eaeugKm206l7AFIjhvKbLTOC9/s1600/texttospeech+design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6rUjnM9y1Dqr0_-3kKeYfpwwNg9tzcxQsgOYTwIJkpi0QZ7W_pEMmfumgI8VPFTmWJxuI_GkU-JnebncO-YTqRCDiChPNHAL0kaxTqMuicr2dqBVoOh1eaeugKm206l7AFIjhvKbLTOC9/s1600/texttospeech+design.png" height="292" width="320" /></a></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now change the name and text of the added controls from the Properties dialog box;</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Control </b> <b>Control Name</b> <b>Text</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b><i>Button</i><b> </b><i>btnRead Read</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Richtextbox rtbTexttoRead</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Now double click on the <i>Read button </i>and copy the below code;</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i> <span style="color: #351c75;">SpeechSynthesizer synth = new SpeechSynthesizer();</span></i></span></div>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><i> synth.SetOutputToDefaultAudioDevice();</i></span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><i> synth.Speak(rtbTexttoRead.Text);</i></span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>5. </i>Now you will have to add a reference to <i><b> </b></i></span><span style="color: #351c75; font-family: 'Trebuchet MS', sans-serif;"><b style="font-style: italic;">System.Speech.Synthesis</b><i> </i>to</span><br />
<span style="color: #351c75; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #073763;"><span style="font-family: 'Trebuchet MS', sans-serif;"> use </span><span style="font-family: 'Trebuchet MS', sans-serif;"><b style="font-style: italic;">SpeechSynthesizer </b>in your project. To do so, Right click on your Project from</span></span><br />
<span style="color: #073763;"><span style="font-family: 'Trebuchet MS', sans-serif;"> Solution Explorer and select <i>Add Reference</i> ( See the Screenshot)</span></span><br />
<span style="color: #073763;"><span style="font-family: 'Trebuchet MS', sans-serif;"> </span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0j8F3ahb7t3GpLoVBoHge3EVq9Lar8olHg78LX70XyodqqxNCWrR3Kc4GydUqBKHixszLi7VLPwNSfYU8i5zhc-FS93up9KVswWjlnu2leEkX5WUWx1t0nNJoPM4oFrnaf9honTrpYJ1u/s1600/addref.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0j8F3ahb7t3GpLoVBoHge3EVq9Lar8olHg78LX70XyodqqxNCWrR3Kc4GydUqBKHixszLi7VLPwNSfYU8i5zhc-FS93up9KVswWjlnu2leEkX5WUWx1t0nNJoPM4oFrnaf9honTrpYJ1u/s1600/addref.png" height="207" width="400" /></a></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span></div>
<br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Now check the </span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><b> </b></i></span><span style="font-family: 'Trebuchet MS', sans-serif;"><b style="color: #351c75; font-style: italic;">System.Speech </b><span style="color: #073763;">as shown in the below screenshot</span></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgemmK-PFm2mbLEoxiapqaJU35xc5qFyf4UEnq6u1K_woMrs1jx6SHTHTwCyfABIHKm0Q7onfTHGYpx3dZlg-A-f5wHfbWbk_Zi7Kx9Jqdo0GiDBw3blv5DNcZ1oDkIreHTtS1gwTnQknSV/s1600/reference.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgemmK-PFm2mbLEoxiapqaJU35xc5qFyf4UEnq6u1K_woMrs1jx6SHTHTwCyfABIHKm0Q7onfTHGYpx3dZlg-A-f5wHfbWbk_Zi7Kx9Jqdo0GiDBw3blv5DNcZ1oDkIreHTtS1gwTnQknSV/s1600/reference.png" height="440" width="640" /></a></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">6. Now Right click on <i>SpeechSynthesizer() </i>and<i> Resolve -> Using System.Speech.Synthesis;</i></span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i> </i>(See the Screenshot)</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwlbYvb-5VtG3fE4ekI8pU_p_tZxOPfHzVOQV_i1q9JOS8nDENZpIXnOQ_743KCHbBjJuRUIiO7v6yvePXZYP5f650DymcYmXMHe4Xf1b2bE0bHB3T6lSjEkBdqVTcvrb7zjXnfk-g8Z1q/s1600/solveerror.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwlbYvb-5VtG3fE4ekI8pU_p_tZxOPfHzVOQV_i1q9JOS8nDENZpIXnOQ_743KCHbBjJuRUIiO7v6yvePXZYP5f650DymcYmXMHe4Xf1b2bE0bHB3T6lSjEkBdqVTcvrb7zjXnfk-g8Z1q/s1600/solveerror.png" height="392" width="640" /></a></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">7. The complete code is shown below;</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<b><span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">Form1.cs</span></b><br />
<b><span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">using System;</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">using System.Speech.Synthesis;</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">namespace TexttoSpeech</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">{</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> public Form1()</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> private void btnReadText_Click(object sender, EventArgs e)</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> SpeechSynthesizer synth = new SpeechSynthesizer();</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> synth.SetOutputToDefaultAudioDevice();</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> synth.Speak(rtbTexttoRead.Text);</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">}</span><br />
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Screenshot</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjShXzBsV5ueEh4W3aMsRGPHZ_eabuB8GwUYI8DlHOxFPQp7Mbw_sXTH544i4k1SWsgtEDN7r0TZiH0BiQWudrEy_oGiWWra5_KbQIIGjLJtbvqGqrUVr8MJFohwweaVtN0SJop3sBaCb8f/s1600/code.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjShXzBsV5ueEh4W3aMsRGPHZ_eabuB8GwUYI8DlHOxFPQp7Mbw_sXTH544i4k1SWsgtEDN7r0TZiH0BiQWudrEy_oGiWWra5_KbQIIGjLJtbvqGqrUVr8MJFohwweaVtN0SJop3sBaCb8f/s1600/code.png" height="448" width="640" /></a></div>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #351c75; font-family: Trebuchet MS, sans-serif;">8. </span><span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;">Rebuild and Run the project, type some text in the <i>richtextbox</i> and click on <i>Read </i>to </span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> read the text ENJOY :-)</span></span><b style="color: #351c75; font-family: 'Trebuchet MS', sans-serif; font-style: italic;"> </b><br />
<b style="color: #351c75; font-family: 'Trebuchet MS', sans-serif; font-style: italic;"><br /></b>
<b style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;">Conclusion</span></b><br />
<b style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><br /></span></b>
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;">In case of any doubts / errors, please drop in a comment.</span></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><br /></span></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><br /></span></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><b>See Also</b></span></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/05/how-to-hide-folders-in-c.html">How to Hide Folders in C#</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/04/lock-folder-in-c.html">Lock a Folder in C#</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/04/how-to-change-ip-address-in-c.html">How to Change IP Address in C#</a></span></li>
</ul>
<div>
<br /></div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-9327403918596988322014-05-15T18:58:00.000+05:302014-05-22T21:56:31.222+05:30How to Start and Kill a Process in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hi, </b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrUd4ue97RbJ2QP5cXiJ9QIMd9IrnmalMjJmHWHzk64vl4e_TfZVoWEfvzplToHlFqcrhvKjdCsYaJDxuaLX4VhVjR_SKmrRfH9rFrbjU2HGloK5W4KJt1vjcnMrOEHOaTFgvAPLME9ow4/s1600/start+and+kill+process.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrUd4ue97RbJ2QP5cXiJ9QIMd9IrnmalMjJmHWHzk64vl4e_TfZVoWEfvzplToHlFqcrhvKjdCsYaJDxuaLX4VhVjR_SKmrRfH9rFrbjU2HGloK5W4KJt1vjcnMrOEHOaTFgvAPLME9ow4/s1600/start+and+kill+process.png" height="125" width="320" /></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><span style="background-color: white; line-height: 20.799999237060547px;">Here you are gonna learn to <i>Start and Kill a Process in </i></span><span style="background-color: white; line-height: 20.799999237060547px;"><i>C#</i>. Suppose if you want to open / close an application such as Notepad, Calculator etc with C# codes, this tutorial will be helpful. </span><br style="background-color: white; line-height: 20.799999237060547px;" /><span style="background-color: white; line-height: 20.799999237060547px;"><br /></span><span style="background-color: white; line-height: 20.799999237060547px;"></span><span style="background-color: white; line-height: 20.799999237060547px;">Let's start;</span></span><br />
<span style="background-color: white; line-height: 20.799999237060547px;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span></span><br />
<a name='more'></a><span style="background-color: white; line-height: 20.799999237060547px;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; line-height: 20.799999237060547px;">Steps</b><br style="background-color: white; line-height: 20.799999237060547px;" /><b style="background-color: white; line-height: 20.799999237060547px;"><br /></b><span style="background-color: white; line-height: 20.799999237060547px;"></span><span style="background-color: white; line-height: 20.799999237060547px;">1. Open <i><b>Visual Studio</b></i> and Create a <i><b>New Project</b></i> -> <i><b>Windows Form Application</b> </i>with</span><br style="background-color: white; line-height: 20.799999237060547px;" /><span style="background-color: white; line-height: 20.799999237060547px;"> Name </span><span style="line-height: 20.799999237060547px;"><b><i>StartKillProcess</i></b></span></span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">.</i><br />
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"><br /></i>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">2</span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">. </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;">Now add 2 buttons to your empty form and design it as shown in the below screenshot.</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> Also change the button names to;</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif; line-height: 20.799999237060547px;"> </span><span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763; line-height: 20.799999237060547px;"> </span><span style="background-color: white; color: #073763; line-height: 20.799999237060547px;"> </span><b style="background-color: white; color: #073763; line-height: 20.799999237060547px;">Name</b><span style="background-color: white; color: #073763; line-height: 20.799999237060547px;"> </span><span style="background-color: white; color: #073763; line-height: 20.799999237060547px;"> </span><span style="background-color: white; color: #073763; line-height: 20.799999237060547px;"> </span><b style="background-color: white; color: #073763; line-height: 20.799999237060547px;">Text</b></span><br />
<div class="separator" style="background-color: white; clear: both; color: #073763; line-height: 20.799999237060547px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b> </b><i>btnStart Start Notepad</i></span></div>
<div class="separator" style="background-color: white; clear: both; color: #073763; line-height: 20.799999237060547px;">
<i><span style="font-family: Trebuchet MS, sans-serif;"> btnStop Stop Notepad</span></i></div>
<div class="separator" style="background-color: white; clear: both; color: #073763; line-height: 20.799999237060547px;">
<i><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></i></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5j22dhhRLyCMiPZeXOkguv6t9TNTlJ8S5zpUyftsNrEPQrX13dU3Tm1LxUTT35Z08aktdf40S0GDvRsLnRwGIhJy05NaDNeRtEE8la1e3hEJQMIEgRnHv62vxfze2RjGheawzaZDtluzL/s1600/Start+Process.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5j22dhhRLyCMiPZeXOkguv6t9TNTlJ8S5zpUyftsNrEPQrX13dU3Tm1LxUTT35Z08aktdf40S0GDvRsLnRwGIhJy05NaDNeRtEE8la1e3hEJQMIEgRnHv62vxfze2RjGheawzaZDtluzL/s1600/Start+Process.png" height="167" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now double click on <i><b>Start Notepad</b></i> button and copy the below code; </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> //to open notepad, for calculator give "<i>calc"</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> System.Diagnostics.Process.Start("Notepad");</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Also double click on <i>Stop Notepad</i> button and copy the below code;</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">Process[] processes = null;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> processes = Process.GetProcessesByName("Notepad");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> foreach (Process process in processes)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> process.Kill();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5. The full source code is shown below;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> <b>Form</b><b>1.cs</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System.Diagnostics;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">namespace StartKillProcess</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> public Form1()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> private void btnStart_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> System.Diagnostics.Process.Start("Notepad");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> private void btnStop_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Process[] processes = null;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> processes = Process.GetProcessesByName("Notepad");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> foreach (Process process in processes)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> process.Kill();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">6. Now Run the project and click on <i>Start Notepad </i>button to open Notepad and click on</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i> Stop Notepad</i> button to close the Notepad.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> <b>Output</b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMCgKkRPv3MhWNhjpFRjKokGADo33sWVLoDyQ1BedVrO55Xw1NoezDbKFr8EDuj8WL9Du_KirfOMVNEUIgVj2WeyEij58J1hQTV57LuanMTxP4bPjXxop8iDmciSJvhR07HlpYP_CMKWXV/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMCgKkRPv3MhWNhjpFRjKokGADo33sWVLoDyQ1BedVrO55Xw1NoezDbKFr8EDuj8WL9Du_KirfOMVNEUIgVj2WeyEij58J1hQTV57LuanMTxP4bPjXxop8iDmciSJvhR07HlpYP_CMKWXV/s1600/output.png" height="346" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Conclusion</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You have learned to Start and Kill a Process in C#. If you have any doubts or errors please comment it.</span></li>
</ul>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html">WCF Tutorial for Beginners</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/05/file-read-and-write-in-c.html">File Read and Write in C#</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html">OpenFileDialog in C#</a></span></li>
</ul>
</div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="background-color: white; clear: both; color: #073763; line-height: 20.799999237060547px;">
<i><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></i></div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-84755257331276971282014-05-06T21:31:00.000+05:302014-05-15T19:06:18.451+05:30File Read and Write in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi,</span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH_o7UQ03odXgpFd2gsSl8XsHBe89EDzet8yEzu_SSI2Zd5GXIPCOPypkIuaYBjjpiWoXHPq90jZgV2V0_WxU6fV02SE0ImFNaQsVi4lOECWMfMq2mDZa9qK14b4TcY2P60ZO8MNsnUltK/s1600/File+Read+and+Write+Design.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH_o7UQ03odXgpFd2gsSl8XsHBe89EDzet8yEzu_SSI2Zd5GXIPCOPypkIuaYBjjpiWoXHPq90jZgV2V0_WxU6fV02SE0ImFNaQsVi4lOECWMfMq2mDZa9qK14b4TcY2P60ZO8MNsnUltK/s1600/File+Read+and+Write+Design.png" height="202" width="320" /></a></span></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you are gonna learn <b><i>File Read and Write in C#.</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">The below project deals with;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> a) Getting data (2 names) from the</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> user.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> b) Write the data into a text file.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> c) Reading the data from the text file</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> and displaying it.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">so let's start</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <b><i>Visual Studio</i></b> -> <b><i>New Project</i></b> -><b><i> Windows Form Application</i></b> with name</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i> FileReadWrite</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now add Buttons, Labels and Textboxes to your empty Form and design it as shown in </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the below screenshot</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; color: #073763; text-align: center;">
<span style="font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDQfmkAzHhJTcSia6inM56RrYE8GxNSZi7VHgXn1CyWk1f8_z7isGuH2ggJOzs4i3HgLs7bZv-morfE0knZ33rCQSJRe4t38zyHo2vDQO1EGZXqf5pNczpQ5Jb_b8B1wA_9XqLpR_OJLHt/s1600/File+Read+and+Write+Design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDQfmkAzHhJTcSia6inM56RrYE8GxNSZi7VHgXn1CyWk1f8_z7isGuH2ggJOzs4i3HgLs7bZv-morfE0knZ33rCQSJRe4t38zyHo2vDQO1EGZXqf5pNczpQ5Jb_b8B1wA_9XqLpR_OJLHt/s1600/File+Read+and+Write+Design.png" height="202" width="320" /></a></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: center;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;">3. Also change the <i><b>Name</b></i> and <i><b>Text </b></i>of the controls added from the Properties dialog box.</span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"> <b>Name</b> <b>Text</b></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><b> </b><i>btnClear Clear</i></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><i> btnOpen Open</i></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><i> btnSave Save</i></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"> txtName1</span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"> txtName2</span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;">4. Now double click on <i style="font-weight: bold;">Clear </i> button and copy the below code;</span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><span style="color: #990000;">//Clear text in both the textboxes</span></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName1.Text = "";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName2.Text = "";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif;">
5. Now double click on <i style="font-weight: bold;">Open </i> button and copy the below code;</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Calling the OpenFile() function</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> OpenFile();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Show data from list to textbox</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (Namelist.Count > 0)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName1.Text = Namelist[0];</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName2.Text = Namelist[1];</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">6. Now double click on </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;">Save </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> button and copy the below code;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Check if both textboxes are not empty</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (txtName1.Text.Length > 0 && txtName2.Text.Length > 0)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Clear();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Add(txtName1.Text);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Add(txtName2.Text);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Calling the SaveFile() function</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> SaveFile();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Saved");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<br /></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">7. Now update your <b>Form1.cs </b>with the below given code;</span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> <b>Form1.cs</b></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System;</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Collections.Generic;</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.IO;</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">namespace FileReadWrite</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //File Path to save the data</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string FileName = Path.Combine(Application.StartupPath,"Data.txt");</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //String List to hold the data to be saved</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> List<string> Namelist = new List<string>();</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnClear_Click(object sender, EventArgs e)</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Clear text in both the textboxes</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName1.Text = "";</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName2.Text = "";</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnSave_Click(object sender, EventArgs e)</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Check if both textboxes are not empty</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (txtName1.Text.Length > 0 && txtName2.Text.Length > 0)</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Clear();</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Add(txtName1.Text);</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Add(txtName2.Text);</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Calling the SaveFile() function</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> SaveFile();</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Saved");</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnOpen_Click(object sender, EventArgs e)</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Calling the OpenFile() function</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> OpenFile();</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Show data from list to textbox</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (Namelist.Count > 0)</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName1.Text = Namelist[0];</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtName2.Text = Namelist[1];</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> void SaveFile()</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Write data to file</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: blue; font-family: Trebuchet MS, sans-serif;">using (FileStream fs = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.None))</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> StreamWriter sr = new StreamWriter(fs);</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> foreach (String data in Namelist)</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> sr.WriteLine(data);</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> sr.Close();</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> void OpenFile()</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (File.Exists(FileName))</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Namelist.Clear();</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //Open data from file</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: blue; font-family: Trebuchet MS, sans-serif;"> using (FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.None))</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> String line = "";</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> StreamReader sr = new StreamReader(fs);</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> while ((line = sr.ReadLine()) != null)</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> Namelist.Add(line);</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> sr.Close();</span></div>
<div>
<span style="color: blue; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">7. Now Run your project and input the names in the textboxes, click on <i>Save. </i>Explore the</span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Application </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">path </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">of your project, there will be a file named </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Data.txt </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">in which you </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> save </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">the names</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>(See the </i></span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">screenshot below). </i></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"></i>
<br />
<div class="separator" style="clear: both; text-align: center;">
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHuEMrBcxp-uVQ92v0ynOjlCawuWv6S-tDu_Owu-aBwXQANf8F-N6_r6_-43XpGlgBhhczrcBlhOd1WukDOHEy66Ecsx6tVTe5ohMtvAeA63gmAuqRJ5aF561mKBR0y24OIqhC1pDklRMi/s1600/Datafile.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHuEMrBcxp-uVQ92v0ynOjlCawuWv6S-tDu_Owu-aBwXQANf8F-N6_r6_-43XpGlgBhhczrcBlhOd1WukDOHEy66Ecsx6tVTe5ohMtvAeA63gmAuqRJ5aF561mKBR0y24OIqhC1pDklRMi/s1600/Datafile.png" height="224" width="640" /></a></i></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">8. Now <i>Clear </i> the names and click on Open, the names will be reloaded from the textfile</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Data.txt.</i></span></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: left;">
<b>Output</b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNw9sKSCVtTI98LOlPAyq34kKOyFDs0WR2QV12OBwuNoL8IVbT0Iggy4uiKSw1Ehzezx0ouN6U6UbWQx8bc1VbqiPENWeKBrBKn3JmhW-P6HVHMaA3lkzBkcdh7Pis87wdQybtRXFYPbPj/s1600/File+Read+and+Write.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNw9sKSCVtTI98LOlPAyq34kKOyFDs0WR2QV12OBwuNoL8IVbT0Iggy4uiKSw1Ehzezx0ouN6U6UbWQx8bc1VbqiPENWeKBrBKn3JmhW-P6HVHMaA3lkzBkcdh7Pis87wdQybtRXFYPbPj/s1600/File+Read+and+Write.png" height="320" width="315" /></a></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>Conclusion</b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
So you have learned to Read and Write Files in C#. In case of any doubts / errors, please drop in a comment.</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>See Also</b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/04/serialize-and-deserializ-in-c.html">Serialize and Deserialize in C#</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/first-c-windows-form-application.html">First C# Windows Forms Application</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/03/digital-clock-in-c.html"><span style="font-family: Trebuchet MS, sans-serif;">Digital Clock in C#</span></a></li>
</ul>
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: center;">
<br /></div>
</div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-44161997266846582782014-05-04T21:43:00.001+05:302014-05-06T21:31:20.758+05:30How to Hide Folders in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hi,</b></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHs9zpYVuRa_TeZjJyqZWi0tX5Pj3FL6-Pqk7AhprgUXCE9q8TghjMKALDAEZLmYpP3ycb8k3u6_fOz89RWfLnEpf02hnNCeBX-l6E2QUVA9nbsouhKv4Ikt6ppW_gajhzKhrb7Ef749G4/s1600/Hide+Folder+Design.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHs9zpYVuRa_TeZjJyqZWi0tX5Pj3FL6-Pqk7AhprgUXCE9q8TghjMKALDAEZLmYpP3ycb8k3u6_fOz89RWfLnEpf02hnNCeBX-l6E2QUVA9nbsouhKv4Ikt6ppW_gajhzKhrb7Ef749G4/s1600/Hide+Folder+Design.png" height="118" width="320" /></a></b></span></div>
<br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hope you have read my previous post on <a href="http://softsprogrammer.blogspot.in/2014/04/lock-folder-in-c.html">Lock a Folder in C#</a>. Now here you can learn How to Hide a Folder in C#. So let's start;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <i style="font-weight: bold;">Visual Studio -> New Project -> Windows Form Application </i>with a name</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> <b> HideFolder.</b></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2.<i> </i>Now add buttons, label, textbox and folderBrowserDialog to your blank form</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> and </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">design it as shown in the below screenshot.</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAyUvD6zlZ_oFjh8NkiSDhsbOVv_mZfDcQwB_SaAh8feLdZjLl1EFjiDUuHQyWamyMVlNi3dgg7aGf764MIdRLM4bwMmvEI0zps1_oG-OybDywDJJELmHbLbuJfo-w6k4ebskb0FHBAoxT/s1600/Hide+Folder+Design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAyUvD6zlZ_oFjh8NkiSDhsbOVv_mZfDcQwB_SaAh8feLdZjLl1EFjiDUuHQyWamyMVlNi3dgg7aGf764MIdRLM4bwMmvEI0zps1_oG-OybDywDJJELmHbLbuJfo-w6k4ebskb0FHBAoxT/s1600/Hide+Folder+Design.png" height="118" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">3.</span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </i><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Rename the controls as given below; (Click on the buttons & textbox and change</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the </span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>Text</i></b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> and </span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>Name</i></b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> from the </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Properties dialog box</i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b> Text Name</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i>Browse - btnBrowse</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Hide - btnHide</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> UnHide - btnUnhide</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Open- btnOpen</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> textbox1- txtFilePath</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Now double click on <i> Browse </i>button and copy the below code;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtFilePath.Text = folderBrowserDialog1.SelectedPath;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5. Now double click on </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Hide </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button and copy the below code;</span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch = new DirectoryInfo(txtFilePath.Text);</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch.Attributes = FileAttributes.Hidden;</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Hidden");</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch { }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">6. Now double click on </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Open </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button and copy the below code;</span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> System.Diagnostics.Process.Start(txtFilePath.Text);</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch { }</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">7. Also double click on </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Unhide </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button and copy the below code;</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #990000;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #990000;"><span style="font-family: 'Trebuchet MS', sans-serif;"> </span><span style="font-family: Trebuchet MS, sans-serif;"> try</span></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch = new DirectoryInfo(txtFilePath.Text);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch.Attributes = FileAttributes.Normal;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Visible");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch { }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">8. Now update your <i style="font-weight: bold;">Form1.cs </i>with the code given below.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Form1.cs</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.IO;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">namespace HideFolder</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> DirectoryInfo ch;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnBrowse_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtFilePath.Text = folderBrowserDialog1.SelectedPath;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnOpen_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> System.Diagnostics.Process.Start(txtFilePath.Text);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch { }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnHide_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch = new DirectoryInfo(txtFilePath.Text);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch.Attributes = FileAttributes.Hidden;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Hidden");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch { }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnUnhide_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch = new DirectoryInfo(txtFilePath.Text);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ch.Attributes = FileAttributes.Normal;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Visible");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch { }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">9. Now Run your project and Browse a folder. The folder path will be shown in the</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> textbox. Now click on Hide button, the folder will be Hidden and you will get a message</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> ( see the screenshot below). Now click on Unhide to make it visible.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV7-tBu7Lq3UaWOFUtOS8Y90CV0vN3VSAScUWNa7a-ulrtJsk9XDEgWJshOrppN1F2bxTuGiyCg0C8ja5AJwSIGSl2XSYUZ1ovOR9g2WEL4mjvd6zQDxz3d5BR1EHgEd1aMyWI8TAfPAhe/s1600/Hide+Folder+Output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV7-tBu7Lq3UaWOFUtOS8Y90CV0vN3VSAScUWNa7a-ulrtJsk9XDEgWJshOrppN1F2bxTuGiyCg0C8ja5AJwSIGSl2XSYUZ1ovOR9g2WEL4mjvd6zQDxz3d5BR1EHgEd1aMyWI8TAfPAhe/s1600/Hide+Folder+Output.png" height="290" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<span style="color: #073763;"><span style="font-family: Trebuchet MS, sans-serif;">So you have learned to Hide folders using C#. Please have a look at</span><span style="font-family: Trebuchet MS, sans-serif;"> the post <a href="http://softsprogrammer.blogspot.in/2014/04/lock-folder-in-c.html">Lock a Folder in C#</a> and by including the code you have learned from here, try to create a Folder Locker that can hide and lock folder.</span></span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><br />
<span style="color: #073763;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></span>
<span style="color: #073763;"><span style="font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/music-player-in-c.html">Music Player in C#</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/04/serialize-and-deserializ-in-c.html">Serialize and Deserialize in C#</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/create-batch-file-timer.html">Create a Batch File Time</a></span></li>
</ul>
<br /></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-71169503993233616162014-04-30T20:47:00.000+05:302014-05-06T20:33:25.996+05:30Serialize and Deserialize in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi,</span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5XsKRIOCn_fCg7qWkVH7tdseoAPctau1QG0n5BFlsX_2I0a7z43YYkqsL_69khHdmfGMrK9NT_uWHyWbb0xFA742p30lVPzJx1z6iotDPsCu4UUoJXTKmaALQFiVjaoxtCqkyy8vq1hwO/s1600/serialize.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5XsKRIOCn_fCg7qWkVH7tdseoAPctau1QG0n5BFlsX_2I0a7z43YYkqsL_69khHdmfGMrK9NT_uWHyWbb0xFA742p30lVPzJx1z6iotDPsCu4UUoJXTKmaALQFiVjaoxtCqkyy8vq1hwO/s1600/serialize.png" height="206" width="320" /></a></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you are gonna learn about <i>Serialization & Deserialization in C#</i>.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Definition</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>Serialization</i> is the process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called Deserialization (<i>From <a href="http://msdn.microsoft.com/en-us/library/ms233843.aspx">MSDN</a></i>).</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Description</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">This project serializes a list of names and saves it, then it deserializes the file and use it as required. so lets go;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <i style="font-weight: bold;">Visual Studio </i>-> <i style="font-weight: bold;">New Project </i>-> <i style="font-weight: bold;">Windows Form Application </i>with a name </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b><i>SerializeDeserialize</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now follow the steps;</span><br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Add 1 combobox, 1 textbox,</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> 2 labels and 1 button to your form</span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Change the <i>combobox Name</i> to <i><b>ComboSavedList</b> </i>and <i>textbox Name</i> to <b style="font-style: italic;">txtNew </b>(from properties dialog box)</span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><b><span style="font-style: normal; font-weight: normal;">Now design your form as shown in the below screenshot. </span></b></i></span></li>
</ul>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU4sMFEC62Vrx12DwGcu4dba7g8fFbeYbKXyNzJDYQ7OgOOq2NRH_IhChOjpisHAMVBeTRXCV44Ups1HzIM9AVgTbC6b7IoTnoUTEuS5XFjsJyt7UKFfll8mBFNMo9oTVP7wrC05lvjUmS/s1600/serializedesign.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU4sMFEC62Vrx12DwGcu4dba7g8fFbeYbKXyNzJDYQ7OgOOq2NRH_IhChOjpisHAMVBeTRXCV44Ups1HzIM9AVgTbC6b7IoTnoUTEuS5XFjsJyt7UKFfll8mBFNMo9oTVP7wrC05lvjUmS/s1600/serializedesign.png" height="206" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now double click on the button <i style="font-weight: bold;">Save </i>and paste the below code</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #741b47;"><span style="font-family: Trebuchet MS, sans-serif;"> </span><span style="font-family: Trebuchet MS, sans-serif;">//checking if textbox contains text</span></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (txtNew.Text.Length > 0)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> string FilePath = Path.Combine(Application.StartupPath, "Data.src");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> string NewData = txtNew.Text;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //adding the new data to the list</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Datalist.Add(NewData);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Calling the Serialize function</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Serialize(FilePath, Datalist);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Deserializing the saved data</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Deserialize(FilePath);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Saved");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Also</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> double click on the Form</span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"> </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">and paste the below code in <b><i>Form_Load </i></b>event handler</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #741b47; font-family: 'Trebuchet MS', sans-serif;"> //Deserialize the file and load it on combobox on application startup</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: 'Trebuchet MS', sans-serif;"> string FilePath = Path.Combine(Application.StartupPath, "Data.src");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (File.Exists(FilePath))</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Deserialize(FilePath);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">5. Now update your <i style="font-weight: bold;">Form.cs </i>as shown in the below code</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Form1.cs</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System.Collections.Generic;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System.IO;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System.Runtime.Serialization.Formatters.Binary;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">namespace SerializeDeserialize</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //String list for saving the data </span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> List<string> Datalist = new List<string>();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> public Form1()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Serialization</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> void Serialize(string FileName, object datalist)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //checking if file exists</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (File.Exists(FileName))</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> File.Delete(FileName);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> using (FileStream fs = new FileStream(FileName, FileMode.Create))</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> BinaryFormatter bin = new BinaryFormatter();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> bin.Serialize(fs, datalist);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> fs.Close();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> catch</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Deserialization</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> void Deserialize(string FileName)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (File.Exists(FileName))</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> BinaryFormatter bin = new BinaryFormatter();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> using (FileStream fs = new FileStream(FileName, FileMode.Open))</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Datalist = (List<string>)bin.Deserialize(fs);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> fs.Close();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Setting the combobox source as Datalist</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> ComboSavedList.DataSource = Datalist;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> catch</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> private void btnSave_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //checking if textbox contains text</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (txtNew.Text.Length > 0)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> string FilePath = Path.Combine(Application.StartupPath, "Data.src");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> string NewData = txtNew.Text;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //adding the new data to the list</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Datalist.Add(NewData);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Calling the Serialize function</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Serialize(FilePath, Datalist);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> //Deserializing the saved data</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Deserialize(FilePath);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Saved");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> private void Form1_Load(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> string FilePath = Path.Combine(Application.StartupPath, "Data.src");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> if (File.Exists(FilePath))</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> Deserialize(FilePath);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #741b47; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b>Code Explanation</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
</div>
<ul style="text-align: left;">
<li><span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;">On running the project, add names to the textbox (txtNew) </span><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">and click on Save. The name will be listed in the combobox (comboSavedList).</span></li>
<li><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">On clicking the Save button, the data in the <i>list </i>(</span><i style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">Datalist) </i><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">is </span><i style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">Serialized </i><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">and saved in the Application's startup path with a name </span><i style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">Data.src. (See the Screenshot below),</i><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">T</span><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">hen the file is Deserialized and the names are listed in the combobox.</span></li>
</ul>
<br />
<div class="separator" style="clear: both;">
<i style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;"><br /></i></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyGEE14mDMnvDLhpMBKk4n7FwNfx6oCivysyA_G1DheU6T4Ten69tRaG9BnCGGhXe5vOvuCthXrXAXeaObQ3C54hyphenhyphendp3RoDErqTeHyaA4ImdSoj1hr_TxUnye50QNMxe1GKUIATc6TnrYx/s1600/datasrc.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyGEE14mDMnvDLhpMBKk4n7FwNfx6oCivysyA_G1DheU6T4Ten69tRaG9BnCGGhXe5vOvuCthXrXAXeaObQ3C54hyphenhyphendp3RoDErqTeHyaA4ImdSoj1hr_TxUnye50QNMxe1GKUIATc6TnrYx/s1600/datasrc.png" height="220" width="640" /></a></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
</div>
<ul style="text-align: left;">
<li><span style="color: #0c343d; font-family: 'Trebuchet MS', sans-serif;">Also the file will be deserialized and loaded to the combobox on application startup.</span></li>
</ul>
<br />
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b>Output</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;">Run the project and enter names to the textbox and click on Save (Screenshot 1). See the name is listed in the combobox. Now restart the application, the combobox still holds the names (Screenshot 2). </span></div>
<div class="separator" style="clear: both;">
<br /></div>
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"></span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7hk86ScTspbyKNoDoO8KfjIb0puv0PJxeYWAnd4On8voRBU9iQGLhNQSrYGjNJy20mXZJa41uqiQw8H33_CAfpmLTUWXtR2kcXe6lSpaXe85iYl02WCspyO8f-9ol_AYkxwKjih_NqIN1/s1600/output1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7hk86ScTspbyKNoDoO8KfjIb0puv0PJxeYWAnd4On8voRBU9iQGLhNQSrYGjNJy20mXZJa41uqiQw8H33_CAfpmLTUWXtR2kcXe6lSpaXe85iYl02WCspyO8f-9ol_AYkxwKjih_NqIN1/s1600/output1.png" height="315" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;">Screenshot 1 : Saving the Data</span></td></tr>
</tbody></table>
<div class="separator" style="clear: both;">
<span style="-webkit-text-stroke-width: 0px; color: #0c343d; font-family: Trebuchet MS, sans-serif; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"></span></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="-webkit-text-stroke-width: 0px; clear: right; font-family: 'Times New Roman'; letter-spacing: normal; margin-bottom: 1em; margin-left: auto; margin-right: auto; orphans: auto; padding: 6px; text-align: center; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjggi2tux9_Yim0NkX-uMi__aLujXiOJ0rTEBDzAxFOXR9BJ2eBuJSwgq6LBqMYkUTIaTteXqnUujmsOlD9Hg75HkIvmVrDFIpJqorf6QJU6W9jhH8adccnKuymUsBQzKf88E9r1T1e-Tfi/s1600/output2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjggi2tux9_Yim0NkX-uMi__aLujXiOJ0rTEBDzAxFOXR9BJ2eBuJSwgq6LBqMYkUTIaTteXqnUujmsOlD9Hg75HkIvmVrDFIpJqorf6QJU6W9jhH8adccnKuymUsBQzKf88E9r1T1e-Tfi/s1600/output2.png" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;"><span style="font-family: 'Trebuchet MS', sans-serif;">Screenshot 2 : Saved data on application restart</span></td></tr>
</tbody></table>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;">Congrats, you have learned to Serialize and Deserialize in C#. Enjoy :-)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;">In case of any errors / doubts feel free to drop a comment.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div class="separator" style="clear: both;">
</div>
<ul style="text-align: left;">
<li><span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/media-player-in-c.html">Media Player in C#</a></span></li>
<li><span style="color: #0c343d; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/04/how-to-change-ip-address-in-c.html">How to Change IP Address in C#</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html"><span style="font-family: Trebuchet MS, sans-serif;">WCF Tutorial For Beginners</span></a></li>
</ul>
<br />
<div class="separator" style="clear: both;">
<br /></div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com3tag:blogger.com,1999:blog-1097823140941068929.post-39723319765088544802014-04-24T18:46:00.000+05:302014-04-30T20:47:30.965+05:30Lock a Folder in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvPpDAY5_79MbNA9QLVLg_J921V1T6LunjW-w7BRw7pF1lbu7UASp_UOc0eze6Q98DId3b8jp9OiBBcVw8ecR9SnI9ZiKWEmAGE0YXQU1jz3fUhj57N2CWjvmecL4BKQN2kqmYgkqlMo5A/s1600/Folder+Lock.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvPpDAY5_79MbNA9QLVLg_J921V1T6LunjW-w7BRw7pF1lbu7UASp_UOc0eze6Q98DId3b8jp9OiBBcVw8ecR9SnI9ZiKWEmAGE0YXQU1jz3fUhj57N2CWjvmecL4BKQN2kqmYgkqlMo5A/s1600/Folder+Lock.png" height="200" width="200" /></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi,</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif; text-align: right;"><span style="text-align: left;"><br /></span></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif; text-align: right;"><span style="text-align: left;">Here you will learn how to </span><b style="text-align: left;">lock </b><span style="text-align: left;">and </span><b style="text-align: left;">Unlock </b><span style="text-align: left;">folders using C#. </span></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">This tutorial is of good use if you are planning to create a </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Folder Locking Software. </i><br />
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></i>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>Let's start;</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i></i></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1.Open <i><b>Visual Studio </b></i>-> <i><b>New Project</b> -> <b>Windows Form Application</b> </i>with name </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i> FolderLock.</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2.Now add <b>buttons</b>,<b> label</b>,<b> textbox</b> and<b> folderBrowserDialog </b>to your blank form and </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> design </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">it as shown in the below screenshot.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwDt7ws2QN5KQkUIzBZdCZgGYaYTHSapSPOhshr7_7cueEIV5ZgYowq3s6tZMYx0UqDy3r2NrlNXeE4cFqnozDIlsrNTJ89bP5xwG4uKtfdlrmT6Vu5IL9vs_W3SSYFyWsLjS_zY6ZSnK6/s1600/Folder+Lock+design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwDt7ws2QN5KQkUIzBZdCZgGYaYTHSapSPOhshr7_7cueEIV5ZgYowq3s6tZMYx0UqDy3r2NrlNXeE4cFqnozDIlsrNTJ89bP5xwG4uKtfdlrmT6Vu5IL9vs_W3SSYFyWsLjS_zY6ZSnK6/s1600/Folder+Lock+design.png" height="144" width="320" /></a></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3.Rename the controls as given below; (Click on the buttons & textbox and change the</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"> Text </i>and <i style="font-weight: bold;">Name </i>from the Properties dialog box)</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i><b>Text Name</b></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i> Lock - btnLock</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Unlock - btnUnlock</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Browse- btnBrowse</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> textbox1- txtFilePath</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Now double click on <i style="font-weight: bold;">Browse </i>button and copy the below code;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #cc0000; font-family: 'Trebuchet MS', sans-serif;"> if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> txtFilePath.Text = folderBrowserDialog1.SelectedPath;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5. Now double click on </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;">Lock </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button and copy the below code;</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> if (txtFilePath.Text.Length > 0)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> try</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string folderPath = txtFilePath.Text;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string adminUserName = Environment.UserName;// getting your adminUserName</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> DirectorySecurity ds = Directory.GetAccessControl(folderPath);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> FileSystemAccessRule fsa = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> ds.AddAccessRule(fsa);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> Directory.SetAccessControl(folderPath, ds);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Locked");</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span><span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> catch</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<div>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">6. Also double click on <i><b>Unl</b></i></span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;">ock </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button and copy the below code;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #cc0000; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #cc0000; font-family: 'Trebuchet MS', sans-serif;">if (txtFilePath.Text.Length > 0)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> try</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string folderPath = txtFilePath.Text;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string adminUserName = Environment.UserName;// getting your adminUserName</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> DirectorySecurity ds = Directory.GetAccessControl(folderPath);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> FileSystemAccessRule fsa = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> ds.RemoveAccessRule(fsa);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> Directory.SetAccessControl(folderPath, ds);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Unlocked");</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> catch</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">7. Now your program code window (<b><i>Form1.cs)</i></b> looks like the below one.</span><br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Form1.cs</b></span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">using System;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">using System.IO;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">using System.Security.AccessControl;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">namespace FolderLock</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">{</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> public partial class FolderLock : Form</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> public FolderLock()</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> private void btnLock_Click(object sender, EventArgs e)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> if (txtFilePath.Text.Length > 0)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> try</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string folderPath = txtFilePath.Text;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string adminUserName = Environment.UserName;// getting your adminUserName</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> DirectorySecurity ds = Directory.GetAccessControl(folderPath);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> FileSystemAccessRule fsa = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> ds.AddAccessRule(fsa);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> Directory.SetAccessControl(folderPath, ds);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Locked");</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> catch</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> private void btnUnlock_Click(object sender, EventArgs e)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> if (txtFilePath.Text.Length > 0)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> try</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string folderPath = txtFilePath.Text;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> string adminUserName = Environment.UserName;// getting your adminUserName</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> DirectorySecurity ds = Directory.GetAccessControl(folderPath);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> FileSystemAccessRule fsa = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> ds.RemoveAccessRule(fsa);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> Directory.SetAccessControl(folderPath, ds);</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("Unlocked");</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> catch</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> private void btnBrowse_Click(object sender, EventArgs e)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> txtFilePath.Text = folderBrowserDialog1.SelectedPath;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">}</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">8. Now <b>Run</b> your project and Browse a folder. The folder path will be shown in the</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> textbox. Now click on Lock button, the folder will be locked and you will get a message</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> ( see the screenshot below). Check if you can open </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">the locked folder, No is it? Now </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> click on Unlock and</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> try again. So you have created</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> a locking software. <i>Enjoy</i> :-)</span><br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b><i>Output</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW0EFPWBY0q_Uns39Ywk5SRg8ubcIyxZIT4q4S5FDZQNDLF5jr32MPX5MPrShqTKlpvfjEfenOLlCuRDh9LMcby0zdEcVyS4QzZta-M6toUzLfrOD-0QsmQY1sJCkO85HQVNdCkdmU_NXF/s1600/locked.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW0EFPWBY0q_Uns39Ywk5SRg8ubcIyxZIT4q4S5FDZQNDLF5jr32MPX5MPrShqTKlpvfjEfenOLlCuRDh9LMcby0zdEcVyS4QzZta-M6toUzLfrOD-0QsmQY1sJCkO85HQVNdCkdmU_NXF/s1600/locked.png" height="310" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Conclusion</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">If you have got any errors / doubts, feel free to comment it.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/how-to-get-ip-address-using-c.html">How to Get IP Address Using C#</a></span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html">OpenFileDialog in C#</a></span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/digital-clock-in-c.html">Digital Clock in C#</a> </span></li>
</ul>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<br />
<div>
<br /></div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com10tag:blogger.com,1999:blog-1097823140941068929.post-50282545869530188462014-04-08T21:49:00.000+05:302014-04-24T18:46:22.974+05:30How to Change IP Address in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi Friends, </span></b><br />
<div class="separator" style="clear: both; text-align: center;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH1HavT4YubtrhXQcxOYCc3gXipjyI3r6-fddQ0Q4bGEWnEwJQVCOdMQsLQCY2jF4saC-LSU9rRSG6AQQ9Tny_ufd0ZOcbfepdjwwURqC7VjWDzc7qowlxoxYWP7ucLe7a-kHg8VxCMyPp/s1600/IP+Setter.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH1HavT4YubtrhXQcxOYCc3gXipjyI3r6-fddQ0Q4bGEWnEwJQVCOdMQsLQCY2jF4saC-LSU9rRSG6AQQ9Tny_ufd0ZOcbfepdjwwURqC7VjWDzc7qowlxoxYWP7ucLe7a-kHg8VxCMyPp/s1600/IP+Setter.jpg" /></a></span></b></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You have learned to <a href="http://softsprogrammer.blogspot.in/2014/03/how-to-get-ip-address-using-c.html">Get IP Address in C# </a></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">from the last post. Here you can learn to change </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">IP Address using C#.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Let's start;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Steps</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <i>Visual Studio</i> and Create a <i>New Project</i> -> <i>Windows Form Application </i>with</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Name <i>IP Setter.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhBqhOtcEdrnkMAIgLvER4R01qdDpXTi5qzuIGWsgVn5Tdi6JbE_9kIO80_z5SZ0MkvziEL3yMlB0uFqQ4_ZFEgaAUc4_EMuuWEqJsG9QmMlbn8ILl6XCHvoZeddisCmECRfVTQdwFWkSM/s1600/newprjct.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhBqhOtcEdrnkMAIgLvER4R01qdDpXTi5qzuIGWsgVn5Tdi6JbE_9kIO80_z5SZ0MkvziEL3yMlB0uFqQ4_ZFEgaAUc4_EMuuWEqJsG9QmMlbn8ILl6XCHvoZeddisCmECRfVTQdwFWkSM/s1600/newprjct.png" height="356" width="640" /></a></i></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now add 1 label, 1 textbox and </span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1 button to the form and </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">design it as shown in the </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> below image. Give the <i>textbox</i> and the <i>button</i> with names <i><b>txtIP</b></i> and <i><b>btnSetIP</b>. </i>Also</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> name your form as<i><b> IP Setter</b></i>.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9EL8hIw-Rb_g2CWQEDpA_7ixG4RbPWYubCg-AZ2pTP87hK3RU1Kaa2Zj9_6oEwg-6KTopgBYb_uVbaj0UyWDq-LbkI8Aa6cC3QpcHA8f6ne_fN7jWCA1bxlrSmIgqPq9QZZSeXoQu9scH/s1600/IP+Setter.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9EL8hIw-Rb_g2CWQEDpA_7ixG4RbPWYubCg-AZ2pTP87hK3RU1Kaa2Zj9_6oEwg-6KTopgBYb_uVbaj0UyWDq-LbkI8Aa6cC3QpcHA8f6ne_fN7jWCA1bxlrSmIgqPq9QZZSeXoQu9scH/s1600/IP+Setter.png" /></a></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-style: italic; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
3. Now double click on the <i>Set IP button</i> and update the code with the one shown below.</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><u>Form1.cs</u></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><u><br /></u></b></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Management;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">namespace IP_Setter</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public void setIP(string ip_address, string subnet_mask)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ManagementClass objMC = new ManagementClass("Win32_NetworkAdapterConfiguration");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ManagementObjectCollection objMOC = objMC.GetInstances();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> foreach (ManagementObject objMO in objMOC)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if ((bool)objMO["IPEnabled"])</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> try</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ManagementBaseObject setIP;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> ManagementBaseObject newIP =</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> objMO.GetMethodParameters("EnableStatic");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> newIP["IPAddress"] = new string[] { ip_address };</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> newIP["SubnetMask"] = new string[] { subnet_mask };</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> setIP = objMO.InvokeMethod("EnableStatic", newIP, null);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> catch (Exception)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnSetIP_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string newIP = txtIP.Text;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string subnetMask = "255.255.255.0";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> setIP(newIP, subnetMask);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> MessageBox.Show("IP Changed Successfully");</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div>
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><u><br /></u></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
4. Now you have to add a reference to <b style="font-style: italic;">System.Management. </b>For doing so, follow </div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
the steps given below;</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Right click on the Project from Solution Explorer and select <i>Add Reference</i>.</span></li>
</ul>
<br style="color: #073763; font-family: 'Trebuchet MS', sans-serif;" />
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8rVF_PRyXv1xcKgwPvSyWHJXGH9tN5v1XiHEAf47n4pHrnzY8KMbpnMKSmYYycnlKYc5MQWOh4UWM5y2q1jCETyjamEEmd2KZkBCJwqwWjvh1ee2E6H5v-YUhrcuUG6n3we9-nKKgVbKs/s1600/addreference.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8rVF_PRyXv1xcKgwPvSyWHJXGH9tN5v1XiHEAf47n4pHrnzY8KMbpnMKSmYYycnlKYc5MQWOh4UWM5y2q1jCETyjamEEmd2KZkBCJwqwWjvh1ee2E6H5v-YUhrcuUG6n3we9-nKKgVbKs/s1600/addreference.png" height="295" width="400" /></a></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now select <i>System.Management </i>from the <i><b>Assemblies tab </b></i>and press OK. So you have imported this namespace to the project</span></li>
</ul>
<br style="color: #073763; font-family: 'Trebuchet MS', sans-serif;" />
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfZiaO66GjcTR1Pv2tjc3Qc0xN6P3mPMVbzb8EBabdK86M8n9QMJnMeP2Nf7fDKuAuMM2RWvxNb9IvtMOUR3ATS0h4qmkE_t7y4OqHtSfzc-DLlqEz_A9qHzSZHbk7a_M_9spgFqojX3aX/s1600/refeernce.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfZiaO66GjcTR1Pv2tjc3Qc0xN6P3mPMVbzb8EBabdK86M8n9QMJnMeP2Nf7fDKuAuMM2RWvxNb9IvtMOUR3ATS0h4qmkE_t7y4OqHtSfzc-DLlqEz_A9qHzSZHbk7a_M_9spgFqojX3aX/s1600/refeernce.png" height="275" width="400" /></a></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now Right Click on the code that shows error related to <i>Management </i>and select Resolve -> <i>Using System.Management( </i>See the screenshot.)<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWo8sJ2adr61YHthWlllAzznD0lrsGLrqqlTrpfN9PgjOI23Sls5kF4vD7xwGADIVEOxK0eV2nO7O3sG9fqxI2tn8aQCXimbejTQ-ulWCt4P95k77JUWaXJQXEgkB6iMcSFp8h3u0k7p3b/s1600/resolve.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWo8sJ2adr61YHthWlllAzznD0lrsGLrqqlTrpfN9PgjOI23Sls5kF4vD7xwGADIVEOxK0eV2nO7O3sG9fqxI2tn8aQCXimbejTQ-ulWCt4P95k77JUWaXJQXEgkB6iMcSFp8h3u0k7p3b/s1600/resolve.png" height="177" width="640" /></a></div>
</span></li>
</ul>
<br />
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5. So you have done your project, now Run it and change your IP using C#. </span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> ENJOY.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> In case of any queries / errors, please drop a comment.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>See Also</b></span></div>
<div class="separator" style="clear: both;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/music-player-in-c.html"><b>Music Player in C#</b></a></span></li>
<li><span style="color: #0b5394; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/media-player-in-c.html"><b>Media Player in C#</b></a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/03/digital-clock-in-c.html"><span style="color: #0b5394; font-family: Trebuchet MS, sans-serif;"><b>Digital Clock in C#</b></span></a></li>
</ul>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com4tag:blogger.com,1999:blog-1097823140941068929.post-27257764534902104752014-03-31T22:03:00.000+05:302014-04-15T11:01:00.827+05:30How to get IP Address using C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b><br /></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hello All,</b></span><br />
<div class="separator" style="clear: both; text-align: right;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrQjsW8rSAl_UxExA5dQN8d-iRxXdXMW9zysYMvQIqGHFyRa4vGuJdOHcUiKfbrJiuaRMC9rlWTDrxqSBAXjGHSOihVcVzJ9KOFbTHlcV2hASu7gIIDFH5paGVv04-Y1nM3I6Hy5FxEdr/s1600/IP+Address.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrQjsW8rSAl_UxExA5dQN8d-iRxXdXMW9zysYMvQIqGHFyRa4vGuJdOHcUiKfbrJiuaRMC9rlWTDrxqSBAXjGHSOihVcVzJ9KOFbTHlcV2hASu7gIIDFH5paGVv04-Y1nM3I6Hy5FxEdr/s1600/IP+Address.png" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here's a tutorial to get your IP Address using C#. </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>N.B: </b></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>Beginners please follow the link to know <a href="http://softsprogrammer.blogspot.in/2014/03/first-c-windows-form-application.html">How to create your First Windows Form Application</a>.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Steps</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <i>Visual Studio -> New Project -> Windows Forms Application.</i> Give name as</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i>IP Address </i>and press <i>OK</i>. (<i>See the Screenshot</i>)</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuaZD0Y1Z46s-WY6as_5Xi7qoye4TctwOuqQ_OAj8PrUud1e_86VeJ1qJC1MOVl7rmV_s8Xd-iWGALI0sU3fnb2SB9YiSr4Bvu-U8BNuq_2sLFKaWCpVPlqtPMFrP-b-YbmIyIHEnAWnjn/s1600/New+Project.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuaZD0Y1Z46s-WY6as_5Xi7qoye4TctwOuqQ_OAj8PrUud1e_86VeJ1qJC1MOVl7rmV_s8Xd-iWGALI0sU3fnb2SB9YiSr4Bvu-U8BNuq_2sLFKaWCpVPlqtPMFrP-b-YbmIyIHEnAWnjn/s1600/New+Project.png" height="340" width="640" /></a></span></div>
<br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now design your Form as shown in the below image. (Change the <i>Form</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> backcolor </i>and </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Form text </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">from the Properties window to make your form same as </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> the one shown below)</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjbKQZL8l08JxwkmJ99oWq1lW2I_3cSZakc__li3nVR3VxZsAcbtxzFYXXYpUoAVyl1JHYaXi9OUPGjZKToUNcNgv4rbgq3qkKgeIlaeVOYEz0K8iVXusC1MJ8Hnrt25AZbFozZjaYUsS1/s1600/Ip+design.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjbKQZL8l08JxwkmJ99oWq1lW2I_3cSZakc__li3nVR3VxZsAcbtxzFYXXYpUoAVyl1JHYaXi9OUPGjZKToUNcNgv4rbgq3qkKgeIlaeVOYEz0K8iVXusC1MJ8Hnrt25AZbFozZjaYUsS1/s1600/Ip+design.png" height="160" width="400" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now click on the Form and get the event handler for <i>Form Load </i>and update the code </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> with the one shown below.</span><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Form1.cs</span></b><br />
<b><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Net;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">namespace IP_Address</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void Form1_Load(object sender, EventArgs e)</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> getIP();</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> void getIP()</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string localIP = string.Empty;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> IPHostEntry host;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> host = Dns.GetHostEntry(Dns.GetHostName());</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> foreach (IPAddress ip in host.AddressList)</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (ip.AddressFamily.ToString() == "InterNetwork")</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> localIP = ip.ToString();</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> textBox1.Text = localIP;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Run your Application and get your form with your IP Address. In case of any errors / </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> doubts, please feel free to comment; I am happy to help you.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/music-player-in-c.html">Music Player in C#</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html">OpenFileDialog in C#</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/digital-clock-in-c.html">Digital Clock in C#</a></span></li>
</ul>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-69978370026684220542014-03-26T22:46:00.000+05:302014-03-31T22:30:34.694+05:30Media Player in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi,</span><br />
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-ZDP9Gq8o8Ct29e6swAD3T7UXo-W-URIdITpaUAD2LgliU9EKy0nQhBB2v0yZPguFKapmSi8tGU6MeW0-HsXoNUv1mCKI0spDLKuWifSz4d0Ng3NAdQSOqmzPo1TyN3taD3QAAb38KHDD/s1600/Media+Player.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-ZDP9Gq8o8Ct29e6swAD3T7UXo-W-URIdITpaUAD2LgliU9EKy0nQhBB2v0yZPguFKapmSi8tGU6MeW0-HsXoNUv1mCKI0spDLKuWifSz4d0Ng3NAdQSOqmzPo1TyN3taD3QAAb38KHDD/s1600/Media+Player.jpg" height="263" width="320" /></a></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">You have learned to create a </span><a href="http://softsprogrammer.blogspot.in/2014/03/music-player-in-c.html" style="font-family: 'Trebuchet MS', sans-serif;">Music Player in C#</a><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">, now here's a tutorial for creating your own Media Player in C# and press OK. </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <i>Visual Studio</i> -> <i>New Project </i>-> <i>Windows Form Application </i>with Name </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"> Media Player.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<br />
<div class="separator" style="clear: both; font-style: italic; font-weight: bold; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_OlbjUgPIXheQECHTAgq1iX3cOYFGvJyYx79XnC6zhio3_IsCAGwQ9Eh4j9l-403gYttj9hVoRsMjq_9e_o_2dwUGavIZ987s_4qwXDObkg8dA1xkxQTwaofiH2mfCBdEt9qZNfk_qdOf/s1600/newproject.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_OlbjUgPIXheQECHTAgq1iX3cOYFGvJyYx79XnC6zhio3_IsCAGwQ9Eh4j9l-403gYttj9hVoRsMjq_9e_o_2dwUGavIZ987s_4qwXDObkg8dA1xkxQTwaofiH2mfCBdEt9qZNfk_qdOf/s1600/newproject.jpg" height="339" width="640" /></a></span></div>
<div class="separator" style="clear: both; font-style: italic; font-weight: bold; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Your project will load with an empty form. Now add <i>Windows Media Player </i>Control</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> to the toolbox (since <i>Windows Media Player </i>Control is not available in the </span></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Toolbox by default). </span></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
3. Steps to load <i>Windows Media Player </i>Control (COM component) into Toolbox.</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<ul>
<li><i>Right Click</i> on <i>General tab </i>(or any other tab) in the Toolbox and select <i>Choose Items</i></li>
</ul>
</span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CvpdqdgmF-AzHBUhEvTfjzIrwplSXQj_ClseEtJ88HBhyAqhsLynytTGBjkDsNT2OmtATMk__9odFj2qAx7puPSqwnnMUevLmBm9ur5wHtrFmtmrtBgogvfg3bYBD_mZuRKoUTvb6RTv/s1600/Toolbox.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CvpdqdgmF-AzHBUhEvTfjzIrwplSXQj_ClseEtJ88HBhyAqhsLynytTGBjkDsNT2OmtATMk__9odFj2qAx7puPSqwnnMUevLmBm9ur5wHtrFmtmrtBgogvfg3bYBD_mZuRKoUTvb6RTv/s1600/Toolbox.png" height="290" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li>Now select <i>COM Components </i>tab and check <i>Windows Media Player </i>and click<i> OK.</i></li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnCUsAnTt4sTPKRIYA54ySZoK6cNyq889jz5W723Mou5jd9cOASCt_hZimmg2aa8d7Sq0xXSlPPejcTU9MYliZXAHkMdNS0hChgg4W2QxmkCGLnCM8kJbEzgJEyklmgL3NhQe7EKGoRoGK/s1600/add+control.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnCUsAnTt4sTPKRIYA54ySZoK6cNyq889jz5W723Mou5jd9cOASCt_hZimmg2aa8d7Sq0xXSlPPejcTU9MYliZXAHkMdNS0hChgg4W2QxmkCGLnCM8kJbEzgJEyklmgL3NhQe7EKGoRoGK/s1600/add+control.png" height="283" width="400" /></a></div>
</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><span style="font-style: normal; font-weight: normal;"><br /></span></i></b>
<br />
<div style="text-align: left;">
<b style="color: #073763;"><i><span style="font-family: Trebuchet MS, sans-serif;"><span style="font-style: normal; font-weight: normal;">4. </span></span></i></b><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Windows Media Player </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">control will appear in the Toolbox. Now drag it to your form </span></div>
<div style="text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> and resize it. </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgagBScOaNeCepsFzoIBwnHOSSC6-7yK4EQpGfJI9GqxmX3-alXmese48xBdGyj3bjfylQmcsPMBtk1oLL5KogV9OTpZTVPcy2Abt4_Xd8x8AkS2-Ha58AcmWMVpja-w6svqyFeqFnZuYJg/s1600/wmp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgagBScOaNeCepsFzoIBwnHOSSC6-7yK4EQpGfJI9GqxmX3-alXmese48xBdGyj3bjfylQmcsPMBtk1oLL5KogV9OTpZTVPcy2Abt4_Xd8x8AkS2-Ha58AcmWMVpja-w6svqyFeqFnZuYJg/s1600/wmp.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Also add 1 <i>button</i> and <i>OpenFileDialog </i>to the form.</span></div>
<div style="text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5. Design the form as shown in the below figure.</span></div>
<div style="text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiDDQqFi82U9_tfKrBtPua3q-PwcjRZA6j6xmaCWjTFFhRHFOAz2BKzYcNssDGyQNBAkXrYAd6ERVGCNRAuMhylep5XHmvlSUNvvA_AxFtUb6ab-Bz1ZGWT12x2_R8hIIHw_jge-cHbaoE/s1600/Media+Player+Design.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiDDQqFi82U9_tfKrBtPua3q-PwcjRZA6j6xmaCWjTFFhRHFOAz2BKzYcNssDGyQNBAkXrYAd6ERVGCNRAuMhylep5XHmvlSUNvvA_AxFtUb6ab-Bz1ZGWT12x2_R8hIIHw_jge-cHbaoE/s1600/Media+Player+Design.png" height="263" width="320" /></a></div>
<br />
<div style="text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;"> </i>6.<b> </b>Click on the Windows Media Player control and press F4 to get the Properties</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> dialog box. Change the <i style="font-weight: bold;">Dock </i>to <i style="font-weight: bold;">Fill. </i>By doing so, the control will stretch to fit in</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> the </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">form. This will be useful if the user resizes the window while your player is</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> running.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmZijsFZJsPI9K1OtaK1Zab35-snoBQJ5HFPZ_aYxtt-pEUtgfH5bASYyqXP5fhNHtjSK8LMWmBgSWtvaZxclI_yYJMB3Cps7_XR_yhDSZBbECMbYdLLzypJMoS_pTY1xbsKAMtqRTvb57/s1600/dock.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmZijsFZJsPI9K1OtaK1Zab35-snoBQJ5HFPZ_aYxtt-pEUtgfH5bASYyqXP5fhNHtjSK8LMWmBgSWtvaZxclI_yYJMB3Cps7_XR_yhDSZBbECMbYdLLzypJMoS_pTY1xbsKAMtqRTvb57/s1600/dock.png" height="250" width="400" /></a></div>
<br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b> </b>7.<b> </b>Now<b> </b>select the button and get the Properties dialog box and change its: </span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b> Name - </b></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">btnbrowse</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> <b>Text - </b>Browse</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Also change the <b>Anchor </b>to <i>Bottom</i>,<i>Right</i> as shown in the below figure.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUnQ1jEomuPfbE4hhLllliQw8HK_OhV8oWi22e613aigzuOhJj2h4zV-XRUetjWyHGH20QX9CBxT7WJFAH1wXH42WF3PZOFep9SAzPW8MA9T57FVMq-5aDn0qMdr1GJKbrmNA7DDtGw_JX/s1600/anchor.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUnQ1jEomuPfbE4hhLllliQw8HK_OhV8oWi22e613aigzuOhJj2h4zV-XRUetjWyHGH20QX9CBxT7WJFAH1wXH42WF3PZOFep9SAzPW8MA9T57FVMq-5aDn0qMdr1GJKbrmNA7DDtGw_JX/s1600/anchor.png" height="320" width="292" /></a></div>
<br />
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"> </i><br />
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><br /></i>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">8. Now double click on the <b>Browse </b>button and update the code with the below one.</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><u><br /></u></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><u>Form1.cs</u></b></span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><u><br /></u></b></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">using System;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">namespace Media_Player</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">{</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> private void btnbrowse_Click(object sender, EventArgs e)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> if (openFileDialog1.ShowDialog() == DialogResult.OK)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> openFileDialog1.Filter = "(mp3,wav,mp4,mov,wmv,mpg)|*.mp3;*.wav;*.mp4;*.mov;*.wmv;*.mpgn|all files|*.*";</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> if (openFileDialog1.ShowDialog() == DialogResult.OK)</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> axWindowsMediaPlayer1.URL = openFileDialog1.FileName;</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<br />
<span style="color: #cc0000; font-family: Trebuchet MS, sans-serif;">}</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><u><i>See the Screenshot</i></u></span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><u><i><br /></i></u></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSUkCgHA8JhL5fHD4lYBaVXeTWZoa8gvgxvMrebcM36h_u7qLzNlQOD9BfroXkEhyO002Uecm8BUZACOFpcb5D5c7pWG1ByIrrQot2EGJH77MGK2Vj16D3I_T5omX1UXPf1uCMRvCQIsBD/s1600/code.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSUkCgHA8JhL5fHD4lYBaVXeTWZoa8gvgxvMrebcM36h_u7qLzNlQOD9BfroXkEhyO002Uecm8BUZACOFpcb5D5c7pWG1ByIrrQot2EGJH77MGK2Vj16D3I_T5omX1UXPf1uCMRvCQIsBD/s1600/code.png" height="322" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><u><i><br /></i></u></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">9. Rebuild and Run the project. You will get your own <i>Media Player</i>. Browse for video</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> files</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> and Enjoy Watching.</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">See Also</span></b><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html"><span style="color: #073763;">OpenFileDialog in C#</span></a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/digital-clock-in-c.html"><span style="color: #073763;">Digital Clock in C#</span></a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">WCF Tutorial For Beginners</span></a></li>
</ul>
<br />
<b><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span></div>
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-O-uC_LOuNcs%2FUzL9y47e-BI%2FAAAAAAAAAk0%2FAiSo8NvHbyU%2Fs1600%2Fwmp.png&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgagBScOaNeCepsFzoIBwnHOSSC6-7yK4EQpGfJI9GqxmX3-alXmese48xBdGyj3bjfylQmcsPMBtk1oLL5KogV9OTpZTVPcy2Abt4_Xd8x8AkS2-Ha58AcmWMVpja-w6svqyFeqFnZuYJg/s1600/wmp.png" -->Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-58506934940546090782014-03-24T22:58:00.002+05:302014-03-26T23:03:47.555+05:30Music Player in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hi All,</b></span><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXwz3gUujgtEc5MIaSSoJnkQqRYL43cn5-CVatnR0JbbBXCBLLd8KOAe5AJfwVPeBNIHwfkbsd8BFecqg2KcPxs8DSZoqETFi-X8ZQ1z06FbPwd-T66hsFl1iRjOEzzWjprQVy54I_brZV/s1600/Music+Player.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: right;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXwz3gUujgtEc5MIaSSoJnkQqRYL43cn5-CVatnR0JbbBXCBLLd8KOAe5AJfwVPeBNIHwfkbsd8BFecqg2KcPxs8DSZoqETFi-X8ZQ1z06FbPwd-T66hsFl1iRjOEzzWjprQVy54I_brZV/s1600/Music+Player.jpg" height="124" width="320" /></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you can learn to <i>Create a Music Player in C#. </i>This is a simple tutorial and even beginners can learn without any confusion.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i style="font-weight: bold;">This Player also supports video files</i><i> (large files are not supported)</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Lets Get Started </b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <i>Visual Studio </i>-> <i>New Project -> Windows Form Application </i>and name it as</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> MusicPlayer.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTvfrrtXulrndjkIuFSEWE5BeO0-_WdT4rDN09rPkNeuqLLNbp_RRMtztRB1CojOTsIQe4awEGYs4WgjNyGfThGSR1_Gokl8dOS6JGpVOJ80Lp3RI9Uyqq7GWZ4K6ip8_nt-nm7Do0FYZ5/s1600/newproject.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTvfrrtXulrndjkIuFSEWE5BeO0-_WdT4rDN09rPkNeuqLLNbp_RRMtztRB1CojOTsIQe4awEGYs4WgjNyGfThGSR1_Gokl8dOS6JGpVOJ80Lp3RI9Uyqq7GWZ4K6ip8_nt-nm7Do0FYZ5/s1600/newproject.jpg" height="339" width="640" /></a></i></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Your New Project will be created with a blank Form. You can Run it by clicking on the</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> green Run/Start button on the top. Now change the name of your form by clicking on</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the form and press F4 to get the <i>Properties </i>dialog box. Here change the Text to</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> "Music Player". If you want, change the <i>BackColor </i>of your form to get a different </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> background color for your form. </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now add 4 <i>buttons</i>, 1 <i>textbox</i> , 1<i> label and an <a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html">OpenFileDialog</a></i> to your form from the</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> toolbox (shown in the</span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> left side of Visual Studio) and design it as shown in the </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">below</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> image. (To add controls </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">to a form, just click on the control from the toolbox and drag</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> it to the form).</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmKwx1wcKp4ad8CBeYDUPWmZc7AVnOkt2R_mLjD2H8Egny_WXBCrTLJVoVIOi1qPO8MQ6nDFUOLc84PvGhoP9eM9XiEMG5Et8O84mGRY8uQomrLUpkE56du7uZ951bivx3EUSuEwjBb_9s/s1600/musicplayerdesign.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmKwx1wcKp4ad8CBeYDUPWmZc7AVnOkt2R_mLjD2H8Egny_WXBCrTLJVoVIOi1qPO8MQ6nDFUOLc84PvGhoP9eM9XiEMG5Et8O84mGRY8uQomrLUpkE56du7uZ951bivx3EUSuEwjBb_9s/s1600/musicplayerdesign.png" height="128" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Click on each control and change its Properties as shown below;</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>button1</b> : Name - <i>btnOpen</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Text - <i>Open</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>button2</b> : Name - btnPlay</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Text - <i>Play</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b> button3</b> : Name - <i> btnPause</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Text - <i>Pause</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> </i></span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">button4</b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">: Name -</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> btnStop</i></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Text - <i>Stop</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b> label1 </b> : Text - <i>Now Playing</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b> textbox1</b> : Name - <i>txtbxFilepath</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Now Add a new Class to your Project. To do that Right Click on your Project from the </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Solution Explorer and <i>Add -> New Item</i> -> <i>Class</i> and name it as <b><i>Music.</i></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; font-style: italic; font-weight: bold; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ_WPeBpGe_aXoSz5gzX4cfFw99qSZPA1VrR8WQTA8K7hgqP_A_a7HKzzE6GYb6Le1pE2w8lhyphenhyphen6ejgVzZQuHVnSmBv3zz62FPd-NaNsRnqUp7CySjv52yimunS82OjqHiTO2dijieqE-Xa/s1600/newclass.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ_WPeBpGe_aXoSz5gzX4cfFw99qSZPA1VrR8WQTA8K7hgqP_A_a7HKzzE6GYb6Le1pE2w8lhyphenhyphen6ejgVzZQuHVnSmBv3zz62FPd-NaNsRnqUp7CySjv52yimunS82OjqHiTO2dijieqE-Xa/s1600/newclass.png" height="267" width="400" /></a></span></div>
<div class="separator" style="clear: both; font-style: italic; font-weight: bold; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">5. Now its time to start the coding part of our project. Update the code of your newly</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> created class <i>Music.cs</i> with the below given code.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b><u>Music.cs</u></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><u><br /></u></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Runtime.InteropServices;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Text;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">namespace MusicPlayer</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> class Music</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To import the dll winmn.dll which allows to play mp3 files</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> [DllImport("winmm.dll")]</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private static extern long mciSendString(string lpstrCommand, StringBuilder lpstrReturnString,</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> int uReturnLength, int hwndCallback);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To open a file to our application</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public void open(string file)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string command = "open \"" + file + "\" type MPEGVideo alias MyMusic";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> mciSendString(command, null, 0, 0);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To play the file</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public void play()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string command = "play MyMusic";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> mciSendString(command, null, 0, 0);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #990000; font-family: 'Trebuchet MS', sans-serif;">//To pause the file</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public void pause()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string command = "stop MyMusic";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> mciSendString(command, null, 0, 0);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #990000; font-family: 'Trebuchet MS', sans-serif;">//To stop the file</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public void stop()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> string command = "close MyMusic";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> mciSendString(command, null, 0, 0);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">6. Now double click on Open button from your form. <i>Event handler</i> for Open button click</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> will be added as shown below.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: center;">
<span style="font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGFxmHVg8dYogQ9CSYLIgdx_1D2NkUNnSD2LpK3teKQhSD45V33GgSv8Dsr480VPDvVHMe2RpewQnGmK383CL9b4wVZ-9ZMV2pu1sv3QuL-u28zPZbEakvc1N8uV20MtcNqXicGqiLcZHX/s1600/event+handler.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGFxmHVg8dYogQ9CSYLIgdx_1D2NkUNnSD2LpK3teKQhSD45V33GgSv8Dsr480VPDvVHMe2RpewQnGmK383CL9b4wVZ-9ZMV2pu1sv3QuL-u28zPZbEakvc1N8uV20MtcNqXicGqiLcZHX/s1600/event+handler.png" height="72" width="400" /></a></span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"> Now do the same for all other buttons (<i>Play</i>, <i>Pause</i> and <i>Stop</i>). Then update the code </span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"> as shown below</span></div>
<div class="separator" style="clear: both; color: #073763; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #990000;">using System;</span></span></div>
<br />
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">namespace MusicPlayer</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> Music m = new Music();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnOpen_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (openFileDialog1.ShowDialog() == DialogResult.OK)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> m.open(openFileDialog1.FileName);</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtbxFilepath.Text = openFileDialog1.FileName;</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnPlay_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> m.play();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnStop_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> m.stop();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> txtbxFilepath.Text = "";</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> private void btnPause_Click(object sender, EventArgs e)</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> m.pause();</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span></div>
<div class="separator" style="clear: both;">
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>N.B :- Always try to add event handlers by double clicking on the controls.Just </b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> typing / copying</b></span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> the code will not add the code that hooks up the </b></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> corresponding events to the handlers.</b></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">7. Now Rebuild and Run your project. See your Music Player is ready and you can open </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> your music file / video file and play it, pause and Stop.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> Output</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> 1. Music</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1JqZTv7Jm785e2ZSUMzBwXIRI9TjnVu9jhkR4kAIjJGggGr1F7hMlQHdMUWXBff61ABpJONM3De0jD3AjRzxhi_FpTVF4celTbeh00kmTaSh1VPZbAP21CXYcTQ-wRkh92mthn5Yx9zCP/s1600/Music+Player.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1JqZTv7Jm785e2ZSUMzBwXIRI9TjnVu9jhkR4kAIjJGggGr1F7hMlQHdMUWXBff61ABpJONM3De0jD3AjRzxhi_FpTVF4celTbeh00kmTaSh1VPZbAP21CXYcTQ-wRkh92mthn5Yx9zCP/s1600/Music+Player.jpg" height="155" width="400" /></a></b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> 2. Video</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4q2Xt6ySVJp7e0jtSt3F-EIoVFXopTDWiKyAQS6v82psQGqIUGeJDYltCSH262jbZzBxv1cS_sbx4nJtPVzSAf3yhYnSqOEFA1ZUZ4_B02kKFS_GR9LZHxkPA6KQdD3tPMkka5l3h2AEJ/s1600/video+Player.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4q2Xt6ySVJp7e0jtSt3F-EIoVFXopTDWiKyAQS6v82psQGqIUGeJDYltCSH262jbZzBxv1cS_sbx4nJtPVzSAf3yhYnSqOEFA1ZUZ4_B02kKFS_GR9LZHxkPA6KQdD3tPMkka5l3h2AEJ/s1600/video+Player.png" height="351" width="400" /></a></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">8. Enjoy the Music. In case of any errors or doubts please feel free to drop in a comment.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> I am happy to help you.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/digital-clock-in-c.html">Digital Clock in C#</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html">OpenFileDialog in C#</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/03/first-c-windows-form-application.html"><span style="font-family: Trebuchet MS, sans-serif;">First C# Windows Form Application</span></a></li>
</ul>
<br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com5tag:blogger.com,1999:blog-1097823140941068929.post-68347808578659582332014-03-17T22:22:00.000+05:302014-03-24T22:59:25.304+05:30Digital Clock in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi Friends,</span><br />
<div class="separator" style="clear: both; text-align: right;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIWssMT1NbjloUpaYkuJnFVp3kpLSaj9hTABMn2Eb6Gm24sFmsMQFKgJuB-LK_KUHzNueVZabRvn5PVbKEUIDSYCgP_cfZQjPeTnRzNjwr57LUJnlULGwF6NJw_dF8T-o4_v5QNQhkv39o/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIWssMT1NbjloUpaYkuJnFVp3kpLSaj9hTABMn2Eb6Gm24sFmsMQFKgJuB-LK_KUHzNueVZabRvn5PVbKEUIDSYCgP_cfZQjPeTnRzNjwr57LUJnlULGwF6NJw_dF8T-o4_v5QNQhkv39o/s1600/output.png" height="133" width="320" /></a></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">This is a simple tutorial to create a <i>Digital Clock in c#.</i> This is presented in a way so that even beginners can learn without any 'hiccups'. So lets start.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>1. </b>Run <b>Visual Studio</b><i>.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>2. </b>Create a <b>New Project</b> -> <b>Windows Form Project</b> and name it as <i>Digitalclock.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifQXEEml38s0CR468HsoI5yc2RMF3-Nc97tTTAPVbqE_KE__n46VTND7FN-7cSr7Vx7CFp7FcYb4MSLt9B5QuX1jXGuqmXGtFlFWVQNqZhqZVr1QVoMY7Ld7EKDQjCpsjGMBzBH6P1qJQy/s1600/newproject.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifQXEEml38s0CR468HsoI5yc2RMF3-Nc97tTTAPVbqE_KE__n46VTND7FN-7cSr7Vx7CFp7FcYb4MSLt9B5QuX1jXGuqmXGtFlFWVQNqZhqZVr1QVoMY7Ld7EKDQjCpsjGMBzBH6P1qJQy/s1600/newproject.jpg" height="339" width="640" /></a></i></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">3. </b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">You will get a blank form. Now design the form like shown in the below image;</span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Add a <b>label </b>and a <b>Timer</b> (<i>To add a timer just click on the timer on the Toolbox and</i></span></div>
<div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i> click on the form) </i></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"></span>
<br />
<div class="separator" style="clear: both; font-style: italic; text-align: center;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkYceJY8uWwgeM3NfavCzjNPy3eGhgVA6CvKHVDfmrKa6OYOkJlsXR4_myeIVb2wIFfO7p-xvzrmzb7JB2VdDklHnNoqC5DZakp0yvdt_rLIgH_GHJYlHmGTQptY3DTWEa06Dw9lL5RR2p/s1600/formdesign.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkYceJY8uWwgeM3NfavCzjNPy3eGhgVA6CvKHVDfmrKa6OYOkJlsXR4_myeIVb2wIFfO7p-xvzrmzb7JB2VdDklHnNoqC5DZakp0yvdt_rLIgH_GHJYlHmGTQptY3DTWEa06Dw9lL5RR2p/s1600/formdesign.png" height="320" width="304" /></a></span></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
</span>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>4. </b>Now click on the label and press F4 to get the <i>Properties window</i>. Here you can change</span></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
</span>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> the Font size of the label (if required you can change the Font color, Font etc )</span></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
</span>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
</span>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>5. </b>Now double click on the <b>timer1</b>, you will be directed to Form1.cs (the coding page).</span></div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
<div class="separator" style="clear: both; text-align: left;">
Here update the codes as shown below:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
</span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
</span></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Form1.cs</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;">using System;</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span><br />
<span style="color: #660000;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">namespace Digitalclock</span></span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;">{</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #660000;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"> private void Form1_Load(object sender, EventArgs e)</span></span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> this.Text = "Digital Clock"; //To set the title</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> timer1.Start(); //starting the timer</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #660000;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"> private void timer1_Tick(object sender, EventArgs e)</span></span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> //to display the time in the label</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> label1.Text = DateTime.Now.ToString("hh:mm:ss tt"); </span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #660000; font-family: Trebuchet MS, sans-serif;">}</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See the screenshot</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpAS-fM7XsuKFKP9gDUzz60FLdnGAeXmouT5G2pIQY2aMGn7Z1App8tg78jKwhbCAtdaeC72P8MZcblO8oEAlHESszXRM3wW1GVNH-al058xgHbjxFiEHR5skEM48ZAggCrZhFiK5Tk5hT/s1600/code.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpAS-fM7XsuKFKP9gDUzz60FLdnGAeXmouT5G2pIQY2aMGn7Z1App8tg78jKwhbCAtdaeC72P8MZcblO8oEAlHESszXRM3wW1GVNH-al058xgHbjxFiEHR5skEM48ZAggCrZhFiK5Tk5hT/s1600/code.png" height="515" width="640" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>6. </b></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Your Digital Clock is ready</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">. </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Now </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Rebuild</i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> and </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Run</i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> your project. See the output shown</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> below:</span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOq5GAppeRHZRmRy0Nna_GNAPtXuytaQwhvGxjy_qP5tFz5l4ewnlf4nQzHbbmPMmu24o8d2rietLpuK-wLhGbzosEg5oN5Wj9jx1WrA-5onCqbcxITCydd3KHsavg8i07v5ym1y8s-w4b/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOq5GAppeRHZRmRy0Nna_GNAPtXuytaQwhvGxjy_qP5tFz5l4ewnlf4nQzHbbmPMmu24o8d2rietLpuK-wLhGbzosEg5oN5Wj9jx1WrA-5onCqbcxITCydd3KHsavg8i07v5ym1y8s-w4b/s1600/output.png" height="133" width="320" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>7. </b>If you want to load your application to the center of the screen, click on the form and </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> press F4 for properties. Now change <i>StartPosition</i> - <i>CenterScreen. </i>You can change the<i> BackColor </i>from properties to change the background color of your form.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>Conclusion</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now you have learned to create a Digital Clock in c#. In case of any doubts or errors from this project, feel free to comment it down, I can help you.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/first-c-windows-form-application.html"><span style="color: #073763;">First C# Windows Form Application</span></a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html"><span style="color: #073763;">OpenFileDialog in C#</span></a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html"><span style="color: #073763;">WCF Tutorial for Beginners</span></a></span></li>
</ul>
<br /></div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-70571720939457396602014-03-13T23:27:00.000+05:302014-03-17T22:23:18.563+05:30OpenFileDialog in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hi Friends,</b> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbGj1MVBg2ZNAtPh3mHerbeVJOa4uL6rRg6DjF4amyafiDdc7DJYsOek08RP_ZA60ShwQlYqeT-DaAKiQfPpeRv8TSIopRFYXRY9jv-JR5AqpQyNyBGYVWuI8bf1-SXauiP_DJFk9LIh44/s1600/output.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbGj1MVBg2ZNAtPh3mHerbeVJOa4uL6rRg6DjF4amyafiDdc7DJYsOek08RP_ZA60ShwQlYqeT-DaAKiQfPpeRv8TSIopRFYXRY9jv-JR5AqpQyNyBGYVWuI8bf1-SXauiP_DJFk9LIh44/s1600/output.png" height="190" width="200" /></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">This tutorial is a continuation of <a href="http://softsprogrammer.blogspot.in/2014/03/first-c-windows-form-application.html">First C# Windows Form Application</a>. So now you know how to create a Windows Form Application in c#. Here you will learn how to use <i style="font-weight: bold;">OpenFileDialog. </i></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">OpenFileDialog is a control that allows users to browse folders and select files.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /><span style="color: #073763;">Here is a tutorial for creating an <b>Image Viewer </b>with OpenFileDialog. </span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><br /></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b>Steps</b></span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b></b></span></span><br />
<a name='more'></a><span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><br /></b></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b>1.</b>Create a<b><i> New Project</i></b> -> <i style="font-weight: bold;">Windows Form Application.</i></span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><i style="font-weight: bold;"> </i>Give the name as<i> "OpenFileDlg"</i></span></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span><span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><i></i></b></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiNTslAMZm0Bqly9MoS2qlNv2K3PMt5PLzsulvDRUJWBJwApkiUFPiVCPC_fhiWeQ4xdAe8CQUVWasG-RcjxXJXjue_ovtouNW5P_XY0b-TcSUvOuj4VP83BC1qoLMNOi_8dyfHWq64pft/s1600/newproject.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiNTslAMZm0Bqly9MoS2qlNv2K3PMt5PLzsulvDRUJWBJwApkiUFPiVCPC_fhiWeQ4xdAe8CQUVWasG-RcjxXJXjue_ovtouNW5P_XY0b-TcSUvOuj4VP83BC1qoLMNOi_8dyfHWq64pft/s1600/newproject.jpg" height="356" width="640" /></a></i></b></span></span></div>
<br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><br /></b></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b>2. </b>Now design the form as given in the below screenshot. </span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh28d2wDcF7LxdYKob7yMl3VgqepIQjBndpeuQqhdp6P76jWqVFUYYAiwYPlj9aU4hXSnC23P0l3HtII7hK_BSA5fjje5vEwO_J01v3SH_rwAz9zCAUDd61tZBmloaSQ1Ti30nD7mPb-_Y0/s1600/formdesign.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh28d2wDcF7LxdYKob7yMl3VgqepIQjBndpeuQqhdp6P76jWqVFUYYAiwYPlj9aU4hXSnC23P0l3HtII7hK_BSA5fjje5vEwO_J01v3SH_rwAz9zCAUDd61tZBmloaSQ1Ti30nD7mPb-_Y0/s1600/formdesign.png" height="400" width="355" /></a></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>3.</b> To add an <i>OpenFileDialog, </i>click on the control from the toolbox and drag it to the</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> form. It will appear in its own area below your form when you try to place it on the </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> form.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHgUzHXy-IqJtyT9qR8Y-8rFlRjoLfayYf3Ul6VmTjkYhCbnfhMECW8wWx2nhTMKZL3u4dkNHq2btmdLgSYNfaUxzlOIhKz5AFUR66uyB-9WdM0v6bk27mJwU9WvDKvKMvS-xTbTmOdJkl/s1600/openfiledlg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHgUzHXy-IqJtyT9qR8Y-8rFlRjoLfayYf3Ul6VmTjkYhCbnfhMECW8wWx2nhTMKZL3u4dkNHq2btmdLgSYNfaUxzlOIhKz5AFUR66uyB-9WdM0v6bk27mJwU9WvDKvKMvS-xTbTmOdJkl/s1600/openfiledlg.png" /></a></span></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>4.</b> Now click on the <i>button</i> -><i> Right mouse click</i> -> select <i>Properties</i> (or click on the</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> button and press <b>F4</b>) and </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">change </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><i> <b><span style="color: #073763;">Name - </span><span style="color: #38761d;">btnBrowse</span></b></i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #073763;"> Text - </span><span style="color: #38761d;">Browse</span><span style="color: #073763;"> </span></i></b></span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i> </i></b></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzWsEtpL2aHuY7yEVoSjttwB8jbOp20hBRtEJs2-8mM1qbFG04lFiqzj0mDC14ka_FksW99iC6Q-QmgZV6qOEmxmEG7D7u-2jK4DZUYQN4yoYxZZhmaibCbx6NnM8Ju19_cc5gwScEryoC/s1600/browseproperties.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzWsEtpL2aHuY7yEVoSjttwB8jbOp20hBRtEJs2-8mM1qbFG04lFiqzj0mDC14ka_FksW99iC6Q-QmgZV6qOEmxmEG7D7u-2jK4DZUYQN4yoYxZZhmaibCbx6NnM8Ju19_cc5gwScEryoC/s1600/browseproperties.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>5. </b>Now open <i>Form1.cs </i>and update the code as given below.</span></div>
<br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><br /></b></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><u>Form1.cs</u></b></span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><u><br /></u></b></span></span>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">using System.Windows.Forms;</span><br />
<span style="color: #990000;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">namespace OpenFileDlg</span></span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">{</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public partial class Form1 : Form</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> public Form1()</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> InitializeComponent();</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To set the title for the Form</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> this.Text = "Image Viewer";</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"> private void btnBrowse_Click(object sender, EventArgs e)</span></span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> openFileDialog1.FileName = String.Empty;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To filter image file formats from others</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> openFileDialog1.Filter = "Image Files (*.jpg,*.png,*.bmp)|*.jpg;*.png;*.bmp|All Files (*.*)|*.*";</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> </span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> if (openFileDialog1.ShowDialog() == DialogResult.OK)</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> {</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To display the selected filepath in the textbox</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> textBox1.Text= openFileDialog1.FileName;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To fit the image in the picturebox</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> //To display the selected image in the picturebox</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> pictureBox1.ImageLocation = textBox1.Text;</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;"> }</span><br />
<span style="color: #990000;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"> }</span></span><br />
<span style="color: #990000;"><span style="font-family: Trebuchet MS, sans-serif;"></span><br /></span>
<span style="color: #990000; font-family: Trebuchet MS, sans-serif;">}</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See the Screenshot</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_Mdv_05aqXxjobVq-zEDAb_NZM8hznCvOhybmtQcIhD76Rxhq4UiWEKiHdKtHOTNg9bN-a8B4PiZnWCWeTaCyyERgJNyvo0_JzMHh9s4XD_YhhErehRh2_flLjVoFd4DUc-as4zxTbnnA/s1600/opncode.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_Mdv_05aqXxjobVq-zEDAb_NZM8hznCvOhybmtQcIhD76Rxhq4UiWEKiHdKtHOTNg9bN-a8B4PiZnWCWeTaCyyERgJNyvo0_JzMHh9s4XD_YhhErehRh2_flLjVoFd4DUc-as4zxTbnnA/s1600/opncode.png" height="370" width="640" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /><b>6. </b>On adding filter in OpenFileDialog, if you want to add another</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> format, just do the following;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><b> <u>Existing</u></b></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #990000;"><span style="font-family: Trebuchet MS, sans-serif;"> </span><span style="font-family: 'Trebuchet MS', sans-serif;">openFileDialog1.Filter = "Image Files (*.jpg,*.png,*.bmp)|*.jpg;*.png;*.bmp|</span></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #990000;"> All Files(*.*)|*.*";</span></span><br />
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></i>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><u>Adding 'gif' format in the filter</u></b></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><b><span style="color: #073763;"> </span><span style="color: #990000;"> </span></b></span><span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #990000;">openFileDialog1.Filter = "ImageFiles(*.jpg,*.png,*.bmp<b>,*.gif</b>)|*.jpg;*.png;*.bmp<b>;*.gif</b>|</span></span><br />
<span style="color: #990000;"><span style="font-family: 'Trebuchet MS', sans-serif;"> All Files</span><span style="font-family: 'Trebuchet MS', sans-serif;">(*.*)|*.*";</span></span><br />
<span style="color: #990000;"><i style="font-family: 'Trebuchet MS', sans-serif;"><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>7. </b>Rebuild your <i>Project </i>and <i>Run. </i>Now click on <i>Browse, </i>select an image and press OK,the</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> image will be</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> displayed on the picture box. See the output below;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Output</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg00dE-u-9vJllNeYOT6k6Xj3z_fEYIoEZ5VjTNwm9L52SDg-FcR__FlaVWoR5K-8QBRiaAQgoL_FYIbPbFy8shx6DMMDg3-4VwX5CnpQ5TQssBj52mK7HCWpJMNyxb802l1P7SV87fLicC/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg00dE-u-9vJllNeYOT6k6Xj3z_fEYIoEZ5VjTNwm9L52SDg-FcR__FlaVWoR5K-8QBRiaAQgoL_FYIbPbFy8shx6DMMDg3-4VwX5CnpQ5TQssBj52mK7HCWpJMNyxb802l1P7SV87fLicC/s1600/output.png" height="380" width="400" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Conclusion</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now you have learned to create a simple Image viewer in C# using <i>Picture box </i>and <i>OpenFileDialog.</i> Feel free to comment in case of any errors or doubts.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/first-c-windows-form-application.html">First C# Windows Form Application</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html">WCF Tutorial for Beginners</a></span></li>
</ul>
<div>
<br /></div>
<div>
<br /></div>
</div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-52356513614485897972014-03-06T22:12:00.001+05:302014-05-05T19:40:16.426+05:30First C# Windows Form Application<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicWbiod23JRmAzGI39Z4GfWgsJuYbLC-WDvAEJx9PpBdMKGl-eRXYXajN7bdKbkelJhm7hzl2Ykd-Puw60STkgTchNemYseaSFj-Bv6e9gX9qh4TVBCESOCgZXrFVx4MBKYBjeGwXiWVsj/s1600/formdesign.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicWbiod23JRmAzGI39Z4GfWgsJuYbLC-WDvAEJx9PpBdMKGl-eRXYXajN7bdKbkelJhm7hzl2Ykd-Puw60STkgTchNemYseaSFj-Bv6e9gX9qh4TVBCESOCgZXrFVx4MBKYBjeGwXiWVsj/s1600/formdesign.jpg" height="152" width="200" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hello All,</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">This is a very simple tutorial on how to create a <i>Windows Form Application in c#</i>.</span><br />
<br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Requirements</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Visual Studio 2008 or higher versions.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>What is Windows Forms?</b></span><br />
<div style="text-align: justify;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Windows Forms (WinForms) is the name given to the graphical application programming interface (API) included as a part of Microsoft .NET Framework, providing access to native Microsoft Windows interface elements by wrapping the extant Windows API in managed code. (Wiki definition)</span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">So lets start.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif; font-size: large;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif; font-size: large;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Run <b><i>Visual Studio</i></b> and click on<i> <b>New Project</b></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Select <i><b>Windows Forms Application</b></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b><i><b></b></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><b><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkiVoQ9SNISfg5Ls58nmkg6C4tn37J6zsFMZ_LonS5YxblDAg57p0c02_ejwMkGG4l5OqBj4kKrfc93Ju60T6hfDgyiQuSxRJk_dM36Mwa7juWnvbNY6TkQWhHn3c0sVxtC8La_Q6a22q/s1600/newproject.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkiVoQ9SNISfg5Ls58nmkg6C4tn37J6zsFMZ_LonS5YxblDAg57p0c02_ejwMkGG4l5OqBj4kKrfc93Ju60T6hfDgyiQuSxRJk_dM36Mwa7juWnvbNY6TkQWhHn3c0sVxtC8La_Q6a22q/s1600/newproject.jpg" height="359" width="640" /></a></b></i></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. You will get a window with an empty form. Now its your turn to design your form.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Click on the <b><i>Toolbox</i></b> in the left side of the Visual Studio, you will get a list</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> of controls. Now add the required control to your form (select the control from</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Toolbox and </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">then add to your form).</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIlcpF8TkR51SUmcs_eFPHo-mlNwwtAbxm0Lrp1BgY4Caeqx0w0X2M7sqerRRrJm6tnFtXPAmUlbU42grcP5TqNDQE9GX8ueSg8HmF-VLhiTkS1A_8GuBR6wGh43yCY_RjRuVKHjM_FoKy/s1600/addingcontrols.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIlcpF8TkR51SUmcs_eFPHo-mlNwwtAbxm0Lrp1BgY4Caeqx0w0X2M7sqerRRrJm6tnFtXPAmUlbU42grcP5TqNDQE9GX8ueSg8HmF-VLhiTkS1A_8GuBR6wGh43yCY_RjRuVKHjM_FoKy/s1600/addingcontrols.jpg" height="318" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. Design your form as shown in the below screenshot.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqh9qjJ63agdfvuKMU5VVNkXUbklHPzwPyVF30nTV8r0fRoGdI4ZQYwkNnw5_Gli88ZgVeqWSJaIFEaqQVMGh92I2LroCBTTDYnCiMWXwuENy7Ny0sZ0xnRdU4O2LCTrqMAl-1ddVstmd7/s1600/formdesign.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqh9qjJ63agdfvuKMU5VVNkXUbklHPzwPyVF30nTV8r0fRoGdI4ZQYwkNnw5_Gli88ZgVeqWSJaIFEaqQVMGh92I2LroCBTTDYnCiMWXwuENy7Ny0sZ0xnRdU4O2LCTrqMAl-1ddVstmd7/s1600/formdesign.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">5. Now click on the <i>Say Hello </i>button, and copy the below code to the window </span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> named </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Form1.cs.</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Your Form1.cs will have the below code except the red colored</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> one, Copy the red colored code and make your Form1.cs looks similar with this.</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><u>Form1.cs</u></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Windows.Forms;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>namespace MyFirstWinForm</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>{</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> public partial class Form1 : Form</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> public Form1()</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> InitializeComponent();</i></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><i><span style="color: #274e13;"> </span><span style="color: #cc0000;"> <b>this.Text = "Softsprogrammer";</b></span> <span style="color: #0b5394;">//to set </span></i></span><span style="font-family: 'Trebuchet MS', sans-serif; text-align: justify;"><span style="color: #0b5394;">form title as "Softsprogrammer"</span></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> private void button1_Click(object sender, EventArgs e)</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><i><span style="color: #274e13;"> </span><span style="color: #cc0000;"><b> string name = textBox1.Text;</b> </span><span style="color: #0b5394;">//declare a string variable to hold textbox value</span></i></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><i><span style="color: #660000;"> </span><b><span style="color: #cc0000;"> MessageBox.Show("Hello " + name);</span> </b><span style="color: #0b5394;">//show a messagebox with "Hello " and the //data the variable "name" holds.</span></i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span><br />
<i><span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"></span></i><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>}</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSpAPr8qypkWaQQ7mYmX6a1EFmTCnuyClS4PEAXbm6b7XJamtC0tn7dh9E2BDKLOp3bKWxFSUFV07e3-MAjjd6cWMp6_S4WruktX0NfZU6dyiXeg4-uThMx3vc_lpZVWYVi1Y6x0IkDs6/s1600/code.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSpAPr8qypkWaQQ7mYmX6a1EFmTCnuyClS4PEAXbm6b7XJamtC0tn7dh9E2BDKLOp3bKWxFSUFV07e3-MAjjd6cWMp6_S4WruktX0NfZU6dyiXeg4-uThMx3vc_lpZVWYVi1Y6x0IkDs6/s1600/code.png" height="435" width="640" /></a><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b></span><br />
<br />
<span style="color: #274e13; font-family: 'Trebuchet MS', sans-serif;"><span style="color: black; font-family: Times New Roman;"><br /></span></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">6. Now <b>Run</b> your project, input your name and click on <i>Say Hello</i> button. See you got a </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> messagebox saying Hello "yourname". See the screenshot of the output</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpZkeKBwpl3UIo4cuIzCAUvrffHW9WUO63smqgdDQ_dI20pgF9zMKNLIF8YcUsHahvdiO_0sqSMErxvEbVTkeUTQ4BK8Bd2sZWNE83u7LdrYx7tHS9QkM0bg4S84E_QKra3Vrk0xWe61dE/s1600/Untitled.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpZkeKBwpl3UIo4cuIzCAUvrffHW9WUO63smqgdDQ_dI20pgF9zMKNLIF8YcUsHahvdiO_0sqSMErxvEbVTkeUTQ4BK8Bd2sZWNE83u7LdrYx7tHS9QkM0bg4S84E_QKra3Vrk0xWe61dE/s1600/Untitled.png" height="400" width="335" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">So you have created your first Windows Form Application. Feel free to comment if you have got any doubts or bugs in creating the project.</span></li>
</ul>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/wcf-tutorial-for-beginners.html">WCF Tutorial for Beginners</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/03/openfiledialog-in-c.html">OpenFileDialog in C#</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/03/music-player-in-c.html"><span style="font-family: Trebuchet MS, sans-serif;">Music Player in C#</span></a></li>
</ul>
</div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-4013049577399400602014-02-27T23:04:00.000+05:302014-03-06T22:13:20.382+05:30WCF Tutorial for Beginners<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2ickBnBFG9CNiOe5Frthpholepuw5J5UoGQIpUIbclkGYDab1_cJEbPSkkIW5vmH2P3Kz-Z8F-hZp85bYUmY60CtNkgSrxcN95Mf8aKsU3IbXJ-35jXTFCsZO5zGm5RHaLQ39I7Dqtmis/s1600/wcf.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2ickBnBFG9CNiOe5Frthpholepuw5J5UoGQIpUIbclkGYDab1_cJEbPSkkIW5vmH2P3Kz-Z8F-hZp85bYUmY60CtNkgSrxcN95Mf8aKsU3IbXJ-35jXTFCsZO5zGm5RHaLQ39I7Dqtmis/s1600/wcf.jpg" height="156" width="320" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><span style="font-size: large;">Definition of WCF</span></b> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Windows Communication Foundation (WCF) is a framework for building<i> service-oriented applications</i>. Using WCF we can build secure, reliable, transacted solutions that integrate across platforms.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif; font-size: large;"><b>Description</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">WCF inter-operate</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> between <i>WCF-based applications and any other processes</i> that communicate via SOAP (Simple Object Access Protocol) messages.</span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">So how can a WCF service be used to communicate using different protocols and from different kinds of applications, for this we </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">want to use a WCF <i>service </i>from an application.</span></li>
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">If we want to use a WCF service, we have to get answer for the three questions given below</span></li>
</ul>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> 1. From <b>where</b> can the client access the service </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> 2. <b>How</b> to access the service i.e protocols and message formats</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> 3. <b>What</b> functionality does the service provides to the clients </span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">The answers for the above questions are known as the <b>ABC</b> of a WCF service.</span></li>
</ul>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><span style="color: red; font-weight: bold;">A</span><span style="color: #073763;"><b>ddress : </b>Like a web service, WCF service also provides a URI which the client</span></span><br />
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> needs</span></span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> to access the WCF service. This URI is called the Address of</span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> WCF service. So we got answer to the first question.</span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><span style="color: red; font-weight: bold;">B</span><span style="color: #073763;"><b>inding : </b>We got the address of WCF service, so we know how to connect</span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> to it from a client. Now we should think about how to communicate</span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> with the service (Protocol wise). So Binding is what defines how the</span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> WCF service handles the communication.It could also define other</span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> communication parameters like <i>message encoding</i> etc. So this clears</span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> the second question.</span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><br /></span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><span style="color: red; font-weight: bold;">C</span><span style="color: #073763;"><b>ontract : </b>It is what defines the <i>public data</i> and <i>interfaces </i>that WCF </span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> service provides to the clients. So we have got answers to all the </span></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> 3 questions asked above.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><br /></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;">Now lets go for your <b>First WCF Project</b></span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><br /></b></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763; font-size: large;"><b>Steps</b></span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b><br /></b></span></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b>1. </b>Launch Visual Studio 2008 or above.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><b>2. </b>Create <i>New Project</i> -> <i>WCF Service Application</i></span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><br /></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg12Nh4qGCxnV8acLl6se53aRihkIwTwajaVemxq0CtJ3XCjeYNh_kwgw7uPND7uh9vD5iUmBgM7RqqvzH1YMRPPsPUTb3MzS19M22qO86c0DBm9fOadt_D8QPHP5s7qVbbxl3_ezlvHjY2/s1600/WCF+Service+Application.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg12Nh4qGCxnV8acLl6se53aRihkIwTwajaVemxq0CtJ3XCjeYNh_kwgw7uPND7uh9vD5iUmBgM7RqqvzH1YMRPPsPUTb3MzS19M22qO86c0DBm9fOadt_D8QPHP5s7qVbbxl3_ezlvHjY2/s1600/WCF+Service+Application.jpg" height="380" width="640" /></a></div>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"><br /></span></span>
<br />
<div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>3. </b>Now your project <i>MyFirstWCF</i> will have <i>Iservice1</i> and <i>Service1. </i>Replace</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the codes of both with the one given below</span><br />
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></b>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Iservice1</b><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i>Code:</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Collections.Generic;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Linq;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Runtime.Serialization;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.ServiceModel;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.ServiceModel.Web;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Text;</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>namespace MyfirstWCF</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>{</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> </i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> [ServiceContract]</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> public interface IService1</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> [OperationContract]</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> string GetData(string Name);</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i></i></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>}</i></span><br />
<div>
<br /></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><u>See the Screenshot</u></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOtfFrQorVKDtJGJfyk0dHk_QfapLUjE2kRcHmrg5XjxVRZnGcilqDpar142U8fr6DZOfoKCEj01ymwJ2kCbPZMIFbp_Arn8dcGT4vdsLPbnp6kPYf8SS8aYKrR44heGQAVpTA6g8wDbXl/s1600/Iservice1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOtfFrQorVKDtJGJfyk0dHk_QfapLUjE2kRcHmrg5XjxVRZnGcilqDpar142U8fr6DZOfoKCEj01ymwJ2kCbPZMIFbp_Arn8dcGT4vdsLPbnp6kPYf8SS8aYKrR44heGQAVpTA6g8wDbXl/s1600/Iservice1.jpg" height="340" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Service1</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>Code:</i></span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></b></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Collections.Generic;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Linq;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Runtime.Serialization;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.ServiceModel;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.ServiceModel.Web;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Text;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>namespace MyfirstWCF</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>{</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> </i></span><i style="color: #274e13; font-family: 'Trebuchet MS', sans-serif;"> public class Service1 : IService1</i></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> public string GetData(string Name)</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> return string.Format("Hello: {0}", Name);</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> </i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>}</i></span></div>
<br />
<u style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">See the Screenshot</u><br />
<u style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></u>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1WJxkOmgkz-_d0a89t3rSTNAxFrl5h3Xpu38VYGkJBL5AOpL5C4lE7dwNzAsr9Qt0KENxUMB4re-oU0C3dsWF6ZwMOKad2sjT5Fy02MgnFdnuYR5uuODMCiCd26tC4natF97jtSbTrl9P/s1600/Service1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1WJxkOmgkz-_d0a89t3rSTNAxFrl5h3Xpu38VYGkJBL5AOpL5C4lE7dwNzAsr9Qt0KENxUMB4re-oU0C3dsWF6ZwMOKad2sjT5Fy02MgnFdnuYR5uuODMCiCd26tC4natF97jtSbTrl9P/s1600/Service1.jpg" height="342" width="640" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><b><span style="color: #073763;"><br /></span></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>4. </b>Now Rebuild <i>MyFirstWCF and Debug. </i>You may get an output page in your browser </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> as shown below.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhymeKO7TfBtHR6KVKMJqYV6dKJmo4ZAQW6zRTF9HauVyKCqGNFTyO8U9kR636AdtwLL-Poo1GepATktKDl_Ei5NKXdWc3EGCcLgMNcBSnXXDed6jWzxE77zZ7RD4oVjFbFJs-MFsWMTyXy/s1600/WCF+Endpoint.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhymeKO7TfBtHR6KVKMJqYV6dKJmo4ZAQW6zRTF9HauVyKCqGNFTyO8U9kR636AdtwLL-Poo1GepATktKDl_Ei5NKXdWc3EGCcLgMNcBSnXXDed6jWzxE77zZ7RD4oVjFbFJs-MFsWMTyXy/s1600/WCF+Endpoint.jpg" height="328" width="640" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> If you are not getting the above output page and getting the below one, </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> don't worry </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">just click on </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Service1.svc, </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">you will get the required output.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU-1qXPnxW4KowrDWv4QbzIcxEXSwlNJiyRDODYaeFTf6MNGxFPDGfHURMZF0WpKUkwuYzzCHjZwGsTKr7BHijMDU5AairlMcltIGZK_FjM0Pzva4c7Qwk6JlqFtd2b8oSCYI673bHl-Lo/s1600/servicedebug1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU-1qXPnxW4KowrDWv4QbzIcxEXSwlNJiyRDODYaeFTf6MNGxFPDGfHURMZF0WpKUkwuYzzCHjZwGsTKr7BHijMDU5AairlMcltIGZK_FjM0Pzva4c7Qwk6JlqFtd2b8oSCYI673bHl-Lo/s1600/servicedebug1.jpg" height="263" width="400" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> The <b>url </b>shown above i.e <b>localhost:22186/Service1.svc </b>is the address of your service.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Note down this </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">address</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">, it is required for further steps.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>5. </b>So we have created a Service and now we need to create a New Project from </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> which we can access the service. So<i> Right click</i> on Main Project file on </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Solution Explorer and <i>Add</i> -> <i>New Project </i>as shown in the below screenshot.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-gpvUtNHmY-fNq00c3wVdYsVsXPvv2A9tAzZm2qtFqHW1nvcP2gBNm79gqGAQhCHCK195jXAAqWMcGExDRafEGexphc1fi-Ig7ZsOENb-8J_7mOfr5rYroAwQbhM44EEL2G2amuIBrLPh/s1600/addnewprjct.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-gpvUtNHmY-fNq00c3wVdYsVsXPvv2A9tAzZm2qtFqHW1nvcP2gBNm79gqGAQhCHCK195jXAAqWMcGExDRafEGexphc1fi-Ig7ZsOENb-8J_7mOfr5rYroAwQbhM44EEL2G2amuIBrLPh/s1600/addnewprjct.jpg" height="308" width="400" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>6. </b>Now you have to add a <i>Windows Form Application </i><i> </i>as shown below.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSYoX0bexxYIvpAi2_aPd5mOciVe4oUVvqa9u0h0Z1gfiK7KG7To_FF_EK5172C-oqVGa4fop9BOdj2OYxBc94hv-SFs-n8xFvc8egPfjXcqL34kAu0aNM-FOSrUDhyphenhyphenQxvmZbQIqqJ0hYh/s1600/form1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSYoX0bexxYIvpAi2_aPd5mOciVe4oUVvqa9u0h0Z1gfiK7KG7To_FF_EK5172C-oqVGa4fop9BOdj2OYxBc94hv-SFs-n8xFvc8egPfjXcqL34kAu0aNM-FOSrUDhyphenhyphenQxvmZbQIqqJ0hYh/s1600/form1.jpg" height="388" width="640" /></a></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>7. </b>Design the Form as shown in the below screenshot</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZFnPFzAqONKxFeCcYWcqbfKlNM3NouoJu84uI5yQu-VgUkf7km1ZzcGyjp0EwVWA_UQEL8ajvcMldDBinnMvnMTtfussrz1bgAgNCvagDNbGvk-gf-YrJaEE2YHvE4FLt7sHhSII6szhyphenhyphen/s1600/form1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZFnPFzAqONKxFeCcYWcqbfKlNM3NouoJu84uI5yQu-VgUkf7km1ZzcGyjp0EwVWA_UQEL8ajvcMldDBinnMvnMTtfussrz1bgAgNCvagDNbGvk-gf-YrJaEE2YHvE4FLt7sHhSII6szhyphenhyphen/s1600/form1.jpg" height="151" width="320" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>8. </b>Here you will have to Add a reference to the service you have created. So just Right</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> click on the project <i>MyForm </i>from <i>Solution Explorer </i>and select <i>Add Service Reference.</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; font-style: italic; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSggGj-a4Drdng4twXbV2TgSNfYaRz-v_2SRQub-huGrtchq4qiQuwFkQAZa2PN7Egt_Ykjr5A0LrON9Xh5axsc8VtKWJggdWtAmSqnsN1laUKeyCt59pH31SRw5abHcXp_UScJZ4u5UMJ/s1600/addservice.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSggGj-a4Drdng4twXbV2TgSNfYaRz-v_2SRQub-huGrtchq4qiQuwFkQAZa2PN7Egt_Ykjr5A0LrON9Xh5axsc8VtKWJggdWtAmSqnsN1laUKeyCt59pH31SRw5abHcXp_UScJZ4u5UMJ/s1600/addservice.jpg" height="515" width="640" /></a></span></div>
<div class="separator" style="clear: both; font-style: italic; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> a)</i> <i> </i>Here you have to give the Address of the Service you got from <b>Step 4</b>.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> (Here its </span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">localhost:22186/Service1.svc ). </b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now Clic</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">k </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>Go.</b></i></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> b) </i>Now under Services, the service you have created will be listed.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> c) Click <i>OK</i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>9. </b>This is the last step and your first WCF Project will be ready with this step.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Double click on <i>Say Hello </i>button and copy the code given below.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Form 1</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Code</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Linq;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Text;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Threading.Tasks;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using System.Windows.Forms;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>using Myform.ServiceReference1;</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>namespace Myform</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>{</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> public partial class Form1 : Form</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> public Form1()</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> InitializeComponent();</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> private void button1_Click(object sender, EventArgs e)</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> {</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> Service1Client client = new Service1Client();</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> MessageBox.Show(client.GetData(textBox1.Text));</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> client.Close();</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> }</i></span></div>
<div class="separator" style="clear: both;">
<i><span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"></span></i></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i>}</i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>10. </b>Now <i>Rebuild</i> and <i>Debug</i> your <b>MyForm</b> Project. Enter your name and click on</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> Say Hello, </i>you will get a Messagebox with <i>Hello</i> added as a prefix to your name.</span></div>
<div class="separator" style="clear: both;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Hello is added by the service. See the screenshot of the output.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyWjNq51UcU2m4luKbRKPCp-mIi5lbfBo126ENFy-NBbruW2_6T62DgKARYdpgUrePNwnAwiF0MZ4m7kS8wMHw0LRj8Fn2vPSQQ6871i-f6XiEPhvAjvkYDrhXww_LtYJ7ks6_FjJX-iG1/s1600/Output.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyWjNq51UcU2m4luKbRKPCp-mIi5lbfBo126ENFy-NBbruW2_6T62DgKARYdpgUrePNwnAwiF0MZ4m7kS8wMHw0LRj8Fn2vPSQQ6871i-f6XiEPhvAjvkYDrhXww_LtYJ7ks6_FjJX-iG1/s1600/Output.jpg" height="305" width="320" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You have done your First WCF Project. If you have any issues or doubts in getting the output for this project, please feel free to drop a comment.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b></span></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> </i></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
</div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com8tag:blogger.com,1999:blog-1097823140941068929.post-22725942988308725062014-02-19T20:13:00.000+05:302014-02-27T23:07:57.005+05:30How to play Video as wallpaper using VLC <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7F293TZ2HksAjJeeBaPuCmpvoH2CWXBo9n77aBuMZiC-QY3IIfyEvhf8nTZEHNDnNierT3r4D3NDruEiP41EwOoFDVxuwD_q1rfd5wA-l0PSMbT18T1XYzRGCEWtxBWo5-2Re1snY0PjF/s1600/VLC.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7F293TZ2HksAjJeeBaPuCmpvoH2CWXBo9n77aBuMZiC-QY3IIfyEvhf8nTZEHNDnNierT3r4D3NDruEiP41EwOoFDVxuwD_q1rfd5wA-l0PSMbT18T1XYzRGCEWtxBWo5-2Re1snY0PjF/s1600/VLC.png" height="200" width="200" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Friends,</b> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Today softsprogrammer is here to share a trick to<b><i> set any video as your Desktop Wallpaper</i></b> using VLC Player. VLC Player is a powerful Video Player which has got a lot of features. To learn more features, please follow this <b><a href="http://softsprogrammer.blogspot.in/search/label/VLC%20Tricks">link</a></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>1. </b>Open <b>VLC Player</b> and <b>press Ctrl + P </b>to open the below window. </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf1BicXr_1__sRKkNHOeICLOi-1UD1VZ0FZ22dX9R0OK2zQUQHaN2B1z68Uul7lJd68ROHQM8Ku1udGU1cvcFEWI0fl1d7_oxkY00D5AfRu-kUGTQoDhAqHxMVD-s14ifljwUZlr33hiO9/s1600/option.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf1BicXr_1__sRKkNHOeICLOi-1UD1VZ0FZ22dX9R0OK2zQUQHaN2B1z68Uul7lJd68ROHQM8Ku1udGU1cvcFEWI0fl1d7_oxkY00D5AfRu-kUGTQoDhAqHxMVD-s14ifljwUZlr33hiO9/s1600/option.jpg" height="355" width="640" /></a></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b>Now <b>Video</b> -> <b>Output</b> -> select <b>DirectX (DirectDraw) Video output </b>and <b>Save</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>2. </b>Open any video to the VLC Player and while playing </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> Right Click on the player</b> <b>-></b> <b>Video -> DirectX Wallpaper</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr0yXPEbOCfPDjVy-go8Fpl3hzDUNRZ1jwU2ldOGlN54VvIoiV5yh8PbTdp7RdJP4jFjQPZseY45tGKsACjCWQc-yzzl4CgbYri7GxnWV-pPI5qTMCMznZZwreJFRh42oWXuPQqe7HjEu_/s1600/set+option.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr0yXPEbOCfPDjVy-go8Fpl3hzDUNRZ1jwU2ldOGlN54VvIoiV5yh8PbTdp7RdJP4jFjQPZseY45tGKsACjCWQc-yzzl4CgbYri7GxnWV-pPI5qTMCMznZZwreJFRh42oWXuPQqe7HjEu_/s1600/set+option.jpg" height="322" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>3. </b>Now Minimize the player and see the magic!!! The video is playing as your </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Desktop Wallpaper.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitGHjVj6fLn8Fxt8ZpnaeSPHJhIG30xlTVywnEXGU6U4ZQy3TlQHzn7QYu5lsXgFvW_D8iqv4RN1F4a0vi4kyqsv4khQxR0iYNK2KxfccOEa4Ttb7CA1AO1j2hbza5x8fwtHwq2I55G_AR/s1600/walls.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitGHjVj6fLn8Fxt8ZpnaeSPHJhIG30xlTVywnEXGU6U4ZQy3TlQHzn7QYu5lsXgFvW_D8iqv4RN1F4a0vi4kyqsv4khQxR0iYNK2KxfccOEa4Ttb7CA1AO1j2hbza5x8fwtHwq2I55G_AR/s1600/walls.jpg" height="141" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>To Close </b>, Select <b>VLC</b> from <b>Taskbar</b> and close. Now sometimes your wallpaper seems</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> missing or seems like a Black Wallpaper. Just<b> Refresh </b>, your wallpapers will</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> be restored.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b>Enjoy :-)</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/show-messagebox-in-windows.html">Show Message box in windows</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/find-serial-key-of-any-software.html">Find Serial Key of any software</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/how-to-use-keyboard-as-mouse.html"><span style="font-family: Trebuchet MS, sans-serif;">How to use Keyboard as Mouse</span></a></li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-19207529566345913432014-02-17T19:59:00.000+05:302014-02-19T20:15:05.148+05:30Hide Folders in Windows using Command Prompt (Hidden Trick)<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9niYX4ZOd1ls5kN3CELiCGXHWP9-xJFRML0e3KDIH3X7a4qen0kAZW8P8jgsbHKfMQndnNPSdgWg6fvWMmROgbka70bBhOptjLDCMx-77Raan9imzDPTZcdFlfOE7UZTa8srH0YmSPtip/s1600/Hidden+Folder.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9niYX4ZOd1ls5kN3CELiCGXHWP9-xJFRML0e3KDIH3X7a4qen0kAZW8P8jgsbHKfMQndnNPSdgWg6fvWMmROgbka70bBhOptjLDCMx-77Raan9imzDPTZcdFlfOE7UZTa8srH0YmSPtip/s1600/Hidden+Folder.jpg" height="240" width="320" /></a></div>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif; font-size: large;">Friends,</span></b><br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">We all know how to hide a folder in Windows.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Just <b>Right Click on the Folder -> Properties -> Check the Hidden Option -> OK</b>.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">These Hidden Folders can be seen if you change the <b>Folder Option</b> to <b>Show Hidden Files.</b> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Most of them know this trick, so you cannot hide a folder or a file from others using this option.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>Softsprogrammer</i> is here with a trick which makes your<b> </b>required <b>Folders to Operating System Files.</b> Please don't panic :-) this doesn't mean that your folder will be converted to an operating system file which the OS needs. </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>No</b>, your <b>Folder's visibility</b> is <b>changed</b> as same as to the <b>visibility of Operating system Files</b>. So these Folders will not be shown if you change the <b>Folder Option to Show Hidden Files</b>. So you can use this trick to hide your personal folders from others<b>.</b></span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b></b></span><br />
<a name='more'></a><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><span style="font-size: large;">Steps</span></b></span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>1.</b> Open <b>cmd </b>(<i>Go to <b>Start</b> -><b>Run</b> -> Type<b> cmd</b> -> Enter</i>)</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>2. </b>Now Type the below code in cmd</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"> </span><b><i><span style="color: #7f6000;">attrib +s +h </span><span style="color: #6aa84f;">E:\Pictures\3D</span></i></b></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><b><i><span style="color: #38761d;"><br /></span></i></b></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #38761d; font-weight: bold;"> </span><span style="color: #073763;">Here the green colored portion is the path of the folder to be hidden</span></i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span><span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #073763;"></span></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<i><span style="color: #073763;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTIXzZpGKP2HLFV_YXs7pR3bnApj1iQ6jc8gSdo29SBz0SoWBqnl3ZREiJNkU984vYrx8XkVfdRjZ9PbcBV3FIi3WaujCXzmZF6sKK6TUB8hD2zeiYFogcRwCjkimKYEkPQ6_eYHESkoqc/s1600/hide.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTIXzZpGKP2HLFV_YXs7pR3bnApj1iQ6jc8gSdo29SBz0SoWBqnl3ZREiJNkU984vYrx8XkVfdRjZ9PbcBV3FIi3WaujCXzmZF6sKK6TUB8hD2zeiYFogcRwCjkimKYEkPQ6_eYHESkoqc/s1600/hide.jpg" height="321" width="640" /></a></span></i></div>
<br />
<i><span style="color: #073763;"> The Folder named <b>3D </b> in E:\Pictures is hidden now.</span></i><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #073763;"><br /></span></i></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #073763;"><br /></span></i></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><b>3. </b>To unhide the Folder, use the below code in cmd</span></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><br /></span></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"> </span></span><b style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #7f6000;">attrib -s -h </span><span style="color: #38761d;">E:\Pictures\3D</span></i></b><br />
<b style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #38761d;"><br /></span></i></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4rGcLCwgtBM8HUyx_KKYRtKekxVZGRhhUPZZdgfVEavsK2GsUXFrunYfokwggO1A0c6RLANecriq8TeosFaMYK6wjaMnm6w6sIWY_xrduUGArosOrnQQ0IXQbpYLvIAd8sx36sVYD2nwD/s1600/unhide.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4rGcLCwgtBM8HUyx_KKYRtKekxVZGRhhUPZZdgfVEavsK2GsUXFrunYfokwggO1A0c6RLANecriq8TeosFaMYK6wjaMnm6w6sIWY_xrduUGArosOrnQQ0IXQbpYLvIAd8sx36sVYD2nwD/s1600/unhide.jpg" height="320" width="640" /></a></div>
<b style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #38761d;"><br /></span></i></b>
<span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #073763;"> Now the Folder <b>3D</b> is visible to all</span></i></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #073763;"><br /></span></i></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"><i><span style="color: #073763;"><br /></span></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif; font-size: large;"><b>Conclusion</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">The Folders hidden by this trick can be viewed also by the method shown in the image below.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCnciTMAzEKpiojDgiAl0tPZxrb7xdRB9pWh14UQ-xz80HxIx-tbsNYHZhdAZeI9OlJWZLFncyIaS18p0WSYFaMDkXWP5fSbRSFkPxro6BrdhBm4AYFsexZkOsgozlDQgxd-KyNTkQzzCo/s1600/view.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCnciTMAzEKpiojDgiAl0tPZxrb7xdRB9pWh14UQ-xz80HxIx-tbsNYHZhdAZeI9OlJWZLFncyIaS18p0WSYFaMDkXWP5fSbRSFkPxro6BrdhBm4AYFsexZkOsgozlDQgxd-KyNTkQzzCo/s1600/view.png" height="320" width="263" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Enjoy :-)</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><span style="font-size: large;">See Also</span></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/how-to-find-serial-no-of-laptop-of.html">How to find Serial no of a Laptop or Computer</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/creating-folder-named-con-in-windows.html">Creating a folder named con in Windows</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/show-messagebox-in-windows.html">Show Message box in Windows</a></span></li>
</ul>
<br />
<br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><span style="color: #073763;"><b><br /></b></span></span></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com2tag:blogger.com,1999:blog-1097823140941068929.post-55267735693915812122014-02-16T22:06:00.002+05:302014-02-17T19:59:37.171+05:30How to use Keyboard as Mouse<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmm7IX4FNO6UB8O4FN1CCUWKUebPyellVTL_ExEBiEqFYhuUhK3KVzMf3Xs9WtM04HBa1ARF1bcpGOGu9Eu1k_yWzu_jR5LYSr4TirdNvvrtLegzlqng0Jy1A6W7sN8NZmOGGXHrxjEiq5/s1600/keyboardasmouse.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmm7IX4FNO6UB8O4FN1CCUWKUebPyellVTL_ExEBiEqFYhuUhK3KVzMf3Xs9WtM04HBa1ARF1bcpGOGu9Eu1k_yWzu_jR5LYSr4TirdNvvrtLegzlqng0Jy1A6W7sN8NZmOGGXHrxjEiq5/s1600/keyboardasmouse.png" height="200" width="181" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Friends,</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">What will you do if our mouse stopped working? This may due to some driver failures, or hardware issues etc. </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Don't worry, Windows have an inbuilt option called </span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Mousekeys.</b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Most of them are not aware of this feature, but now you are. You can</span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Enable / Disable</b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> Mousekeys very easily.</span><br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">By Enabling Mousekeys, you can use your <b>Keyboard as a substitute to your Mouse.</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b></b></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><b>1. </b>You can Enable Mousekeys by pressing </span><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;">Alt + Shift + Numlock </i><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">keys. Then you will</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> get a prompt as shown below where you need to press </span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">Yes.</b><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwPBj_XoJxb35u85eXMQKB-mHhK_oJc3a2AjR_RiIXt_OSfozATKK325QsaFwA1da90ACH4RvRDSjgqcEhMXhFKfegJpvjlE2tAHRa-QRufuu4ccYuOJX5JPiDInxCTW3jaPWFITQAuln-/s1600/Use-keyboard-as-mouse.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwPBj_XoJxb35u85eXMQKB-mHhK_oJc3a2AjR_RiIXt_OSfozATKK325QsaFwA1da90ACH4RvRDSjgqcEhMXhFKfegJpvjlE2tAHRa-QRufuu4ccYuOJX5JPiDInxCTW3jaPWFITQAuln-/s1600/Use-keyboard-as-mouse.jpg" height="165" width="400" /></a></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>2. </b>Make sure your <b>Numlock is OFF</b> while you use your Keyboard as Mouse.</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>3. </b>Now you can see <b>Mousekeys Icon</b> on your Taskbar, means you are all set.</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>4. </b>You can use<b> 8, 2, 4 and 6 Keys </b>from Numpad to <b>Move Up, Down, Left and</b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b> Right</b> respectively.</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
Also there is a portable software called<b> <a href="http://neatdecisions.com/products/neatmouse/">NeatMouse</a></b> which can be used to use Keyboard as</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
a substitute to Mouse.However no one will choose working without Mouse for a long time, </div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
so the first choice is more preferable.</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>See Also</b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/useful-online-tools-part-1.html">Useful Online Tools Part 1</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/how-to-open-banned-websites.html">How to Open Banned Websites</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/find-your-lost-mobile-using-imei-number.html"><span style="font-family: Trebuchet MS, sans-serif;">Find your Lost Mobile using IMEI Number</span></a></li>
</ul>
<br /></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-32865937861748911362014-02-14T19:45:00.000+05:302014-02-16T22:13:00.272+05:30Find Your Lost Mobile Using IMEI Number<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHD7KcF7u2jcP750hW_9xIASoJp1SA8xOeQx9Lb0eG6F-nJO2QHCbz-xiRtEQu2IzlVYn8c1jc0RBT0oIiD7b9XRQc0lHUq6miYvpzgz1uEsAXzdBk2sdE0PHyoL7lI2yCanor5J4EGjdy/s1600/Theft.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHD7KcF7u2jcP750hW_9xIASoJp1SA8xOeQx9Lb0eG6F-nJO2QHCbz-xiRtEQu2IzlVYn8c1jc0RBT0oIiD7b9XRQc0lHUq6miYvpzgz1uEsAXzdBk2sdE0PHyoL7lI2yCanor5J4EGjdy/s1600/Theft.png" height="172" width="320" /></a></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Friends,</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>International Mobile Station Equipment Identity</b> or<b> IMEI</b> is a unique number to identify mobile phones.</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">To know your IMEI Number just dial </span><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">*#06#</b><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> ,</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">you wil</span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">l</span><br />
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">get a </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">15 digit number.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">This number can be used to <b>Trace / Stop</b> your phone from using the network whether or not the phone's SIM is changed.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">So if your <b>Phone is stolen</b>, you can <b>Find it </b>by using the below trick based on IMEI Number.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Steps</span></b><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Note down the <b>IMEI Number</b> of your lost mobile phone and open your <b>email id</b>.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now compose a <b>New Mail </b>by giving the following info</span><br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Your name:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Address:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Phone model:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Make:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Last used No:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> E-mail for communication:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> Missed date:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> IMEI No:</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> and send to <b><i>cop@vsnl.net</i></b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> see the screenshot</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcOceSupeJBC2elOn5GEYh0hVi6m6WJbazr2IF0P0IWuzZjUbwjfKsCTZ1uF1pePrcgPRxBcr_MNIrHNCfU5MU3seZ1w485QBNbadtTsL90CaX76GYz6AcCW3wiGtUE1sgac7UpxbMi8Xd/s1600/mai.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcOceSupeJBC2elOn5GEYh0hVi6m6WJbazr2IF0P0IWuzZjUbwjfKsCTZ1uF1pePrcgPRxBcr_MNIrHNCfU5MU3seZ1w485QBNbadtTsL90CaX76GYz6AcCW3wiGtUE1sgac7UpxbMi8Xd/s1600/mai.png" height="366" width="400" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. <b>Now wait for reply from <i>cop@vsnl.net</i>, if your mobile is in use, they will trace</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> it out and inform you shortly.</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/make-browsing-safe-when-using-friends.html"><span style="color: #073763;">Make browsing safe when using a Friend's system or in a Net Cafe</span></a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/how-to-open-banned-websites.html"><span style="color: #073763;">How to open Banned Websites</span></a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/useful-online-tools-part-1.html"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Useful Online Tools part 1</span></a></li>
</ul>
<br />
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com1tag:blogger.com,1999:blog-1097823140941068929.post-50598000935062939862014-02-11T19:50:00.000+05:302014-02-14T19:45:20.883+05:30How to Open Banned Websites<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWAMMKkROhqqav82rMWlf9kds570g4RZNWnaittn0PsAeXgM2e82m-bFI6IVP8eLFOF8EB-OJk4chiAWYqjuaktQeWTosHSqFNjn7Wt5HUeb1XqMHy5sCZMuYne44dU3yho_7yj-JHYCuu/s1600/aceesdenied.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWAMMKkROhqqav82rMWlf9kds570g4RZNWnaittn0PsAeXgM2e82m-bFI6IVP8eLFOF8EB-OJk4chiAWYqjuaktQeWTosHSqFNjn7Wt5HUeb1XqMHy5sCZMuYne44dU3yho_7yj-JHYCuu/s1600/aceesdenied.jpg" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Friends,</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you will learn an awesome trick to open banned sites without downloading any softwares.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Many websites are banned in Colleges, Offices etc.Using this trick you can access those sites.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here , I am revealing one of the fastest and secure proxy site for the same.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Steps</span></b><br />
<b><br /></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">1. Open <a href="http://incloak.com/">www.incloak.com/</a> in your browser.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Now just enter the <b>URL</b> of the site you want to open.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBxoE5OhqSp1DlPGyIK2U-pgcGecC7vU2qozpi-aNuKqgahbCvO5r7Rxsuk4ev97ECdUoT4uXyinYQLqvpnPoMuFDO5kwH3vR5QcYhj35DbHMyIG6gQT6eOnOp-bw-90Gcn5JL-fvlsw59/s1600/proxy.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBxoE5OhqSp1DlPGyIK2U-pgcGecC7vU2qozpi-aNuKqgahbCvO5r7Rxsuk4ev97ECdUoT4uXyinYQLqvpnPoMuFDO5kwH3vR5QcYhj35DbHMyIG6gQT6eOnOp-bw-90Gcn5JL-fvlsw59/s1600/proxy.jpg" height="173" width="400" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now click on <b>Hide Me </b>and Enjoy</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/create-batch-file-timer.html">Create a batch File Timer</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/download-youtube-videos.html">Download Youtube Videos</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/calculator-tricks-in-windows-7.html"><span style="font-family: Trebuchet MS, sans-serif;">Calculator Tricks in Windows 7</span></a></li>
</ul>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-70949856752965396552014-02-10T20:06:00.000+05:302014-02-17T18:37:21.636+05:30Show Messagebox in Windows<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMoHTGwFdelLIm5sY03CcWk-hKG6gxfee8xIFCQIeJr-fwveU6kjRBRpBml3YoB8B9-DHNb_26uX3VuCHuAssuP2XZoOdqj_rvR5Jk_FQNEoW4fX_tAFg6SODB24DcSgxSgFo3q0Wi_5XV/s1600/softsprogrammer.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMoHTGwFdelLIm5sY03CcWk-hKG6gxfee8xIFCQIeJr-fwveU6kjRBRpBml3YoB8B9-DHNb_26uX3VuCHuAssuP2XZoOdqj_rvR5Jk_FQNEoW4fX_tAFg6SODB24DcSgxSgFo3q0Wi_5XV/s1600/softsprogrammer.png" height="129" width="320" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Friends,</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here you will learn how to create a Messagebox in Windows.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You can create your own messageboxes with the help of Notepad by this vbs trick.</span><br />
<br />
<a name='more'></a><br /><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Steps</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>1. </b>Open<b> Notepad </b>and Type the code given </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">below;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #7f6000;"> x = msgbox("Your Text Here",</span><span style="color: red;">0</span><span style="color: #7f6000;">,"Your Title Here")</span></i></b></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #7f6000;"><br /></span></i></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3IYcF96N-aD3g8yvJQqd6uT2FTXr9B3kKx6yKi1ny9hktfAN7rWCJx8s-l49p9u22q_sGBrb7BIpFc3fnr9ZZP9qvc_P_E9LY56kes38HuqZnAjRlbC6wmN0Y8Q8X1Ra_a_ncpwhJ2ty1/s1600/code.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3IYcF96N-aD3g8yvJQqd6uT2FTXr9B3kKx6yKi1ny9hktfAN7rWCJx8s-l49p9u22q_sGBrb7BIpFc3fnr9ZZP9qvc_P_E9LY56kes38HuqZnAjRlbC6wmN0Y8Q8X1Ra_a_ncpwhJ2ty1/s1600/code.png" height="185" width="400" /></a></div>
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #7f6000;"><br /></span></i></b></span>
<span style="color: #7f6000; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i>2</i><i style="font-weight: bold;">. </i>Now<i style="font-weight: bold;"> "Save As" "Softsprogrammer.vbs" </i>(Any name with .vbs extension will do)<b>.</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Change the <b><i>Save As Type</i></b> to <b><i>All Files</i></b> before <b>Saving.</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBtaxM8Wvzddp8m0ZKRLe3xIgTaRCI9tBeeZJKMBMlBQ9wGfAhS4h1uNHF3dnMMhs8upHPM1GMSnXNWP06JcRW_E1wdpwAct7rz5vvUiIQ7rcDcfRDtji4dvo9kLFpeUPKYamR2t4N3BSc/s1600/save.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBtaxM8Wvzddp8m0ZKRLe3xIgTaRCI9tBeeZJKMBMlBQ9wGfAhS4h1uNHF3dnMMhs8upHPM1GMSnXNWP06JcRW_E1wdpwAct7rz5vvUiIQ7rcDcfRDtji4dvo9kLFpeUPKYamR2t4N3BSc/s1600/save.png" height="68" width="400" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4<b>. </b>Now click on the vbs file to get a Messagebox. :-)</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCMvuBs2Yen_dlqJE6ZH4i0VzqkZl4jIep0pn8rGjuvHnZ9Uf3RlLSx44oH6l71FgB0tasSVj57tk4gCXOb05Mr_oa_Dl0WZeU9TXghGA0YV6HEFzRQv8s6CAMvIK42JRzRV7Vm45b48lq/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCMvuBs2Yen_dlqJE6ZH4i0VzqkZl4jIep0pn8rGjuvHnZ9Uf3RlLSx44oH6l71FgB0tasSVj57tk4gCXOb05Mr_oa_Dl0WZeU9TXghGA0YV6HEFzRQv8s6CAMvIK42JRzRV7Vm45b48lq/s1600/output.png" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<i><b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Also you can change the </span><span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">style of your </span></b></i><i><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Message box</b> <b>by changing </b></span></i><i><b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="font-family: Trebuchet MS, sans-serif;"><span style="color: red;">0 </span><span style="color: #073763;">with </span></span></b></i><br />
<i><b><span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;">the below codes</span></span></b></i><br />
<br />
<ul style="text-align: left;">
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">0 = OK button only</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">1 = OK and Cancel buttons</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">2 = Abort, Retry, and Ignore buttons</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">3 = Yes, No, and Cancel buttons</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">4 = Yes and No buttons</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">5 = Retry and Cancel buttons</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">16 = Critical Message icon</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">32 = Warning Query icon</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">48 = Warning Message icon</i></li>
<li><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">64 = Information Message icon</i></li>
</ul>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span></div>
<div>
<br /></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You can convert this<a href="http://www.vbs2exe.com/"> <b><i>vbs file to exe</i></b></a> to make it uneditable.</span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/create-software-that-reads-text-talk-it.html">Create a Software that Reads Text (Talk IT)</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/create-your-own-file-folder-opener.html">Create your own File/Folder Opener Software</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/know-your-computers-gender.html">Know your Computer's Gender</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/01/creating-folder-named-con-in-windows.html"><span style="font-family: Trebuchet MS, sans-serif;">Creating a Folder named con in Windows</span></a></li>
</ul>
</div>
<br />
<i><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span></i></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-21938188505603509382014-02-06T21:07:00.000+05:302014-03-18T19:44:37.037+05:30Useful Online Tools<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVJ1BETpxoEoBGz47GWVHvgkAMn_b4fULi2sJnHR_5pz8tG2z_87LdlXiCO9JvVjpRLSZb9coJ_dSnBePTskAn5s_gf5rk4-BRB3XK5BBfF1NymuIi1izxL_4-i9mBXkr_k-rlY6OvFd4u/s1600/onlinetool.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVJ1BETpxoEoBGz47GWVHvgkAMn_b4fULi2sJnHR_5pz8tG2z_87LdlXiCO9JvVjpRLSZb9coJ_dSnBePTskAn5s_gf5rk4-BRB3XK5BBfF1NymuIi1izxL_4-i9mBXkr_k-rlY6OvFd4u/s1600/onlinetool.jpg" height="181" width="320" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Hi Friends,</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Today I will make you familiarize with some very useful online sites.If you are at Office or at Home, sometimes you may not be able to get the required software for your purpose. Obviously you will be searching the same online. Here are those sites which you require at crucial times.. </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>1. <a href="http://convertonlinefree.com/">PDF to Word</a> </b> -<i>http://convertonlinefree.com/</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> This is a very useful site to convert ;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <b><i> </i></b></span><span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 1. Word to PDF</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 2. Image to PDF</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 3. PDF to TXT</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 4. PDF to Word</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 5. Other documents to PDF etc...</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwN7Yx2RMEDQicGaCqBxtbjsGs9H-keJVjDqd9_RC2TKNvuKHv8jRSoH90oeh4FXQwGx7SbP-4VVojkRWNzhBc00Q6Tg_-mP6T6VcwnSlZkGaFkdybYSpKX-gq1Miv2dPSyvKjeRzhidiv/s1600/pdfword.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwN7Yx2RMEDQicGaCqBxtbjsGs9H-keJVjDqd9_RC2TKNvuKHv8jRSoH90oeh4FXQwGx7SbP-4VVojkRWNzhBc00Q6Tg_-mP6T6VcwnSlZkGaFkdybYSpKX-gq1Miv2dPSyvKjeRzhidiv/s1600/pdfword.png" height="151" width="320" /></a></div>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>2</b>. <a href="http://www.picmonkey.com/" style="font-weight: bold;">Image Editor</a><b> -</b><i>http://www.picmonkey.com/</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b></b> Using this site, you can ;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><b><i><span style="color: #274e13;"> Edit Images just like an Image Editor</span></i></b></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #274e13;"><br /></span></i></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9De3o8399NVsHHfPlqYL7M4kopZ-jCRdwuDIvtLV9BfWMnSrITZPmhpfKodEUfLdUoZQyEI3LyRS7iCDO8lKwtFPelcAqu7qDaNuARNvmy1gFd_ylTADWqZfVAwcQVShm86jCHCmeTKjY/s1600/picmonkey.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9De3o8399NVsHHfPlqYL7M4kopZ-jCRdwuDIvtLV9BfWMnSrITZPmhpfKodEUfLdUoZQyEI3LyRS7iCDO8lKwtFPelcAqu7qDaNuARNvmy1gFd_ylTADWqZfVAwcQVShm86jCHCmeTKjY/s1600/picmonkey.jpg" height="125" width="320" /></a></div>
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #274e13;"><br /></span></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>3. </b><a href="https://imgflip.com/images-to-gif" style="font-weight: bold;">Animated Gif Creator</a><b> -</b><i>https://imgflip.com/images-to-gif</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b></b> This site is helpful in ;</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"> <b> 1. <i>Creating Animated Gif images with multiple </i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> images.</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 2. Also you can adjust the Delay, Width, Height, Quality</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> etc.. of your animated image.</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwm4f2hhD-EvgykgFCuyZbhgLsai5WrID8x28hmeHg6ZN-T-Wty8YEHRSlD0H1i6SwKzmEZpFSVruc0fwpfMhpoa0DoQXfbUSDE8phFCKxHpbKnhdq4nvQUdrfVwFmyVZA5E5Q8rEAUYXu/s1600/gifcreator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwm4f2hhD-EvgykgFCuyZbhgLsai5WrID8x28hmeHg6ZN-T-Wty8YEHRSlD0H1i6SwKzmEZpFSVruc0fwpfMhpoa0DoQXfbUSDE8phFCKxHpbKnhdq4nvQUdrfVwFmyVZA5E5Q8rEAUYXu/s1600/gifcreator.png" height="138" width="320" /></a></i></b></span></div>
<br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>4. <a href="http://www.onlinecharttool.com/">Chart Maker</a> -</b> <i>http://www.onlinecharttool.com/</i><br /> In this site, you can create different types of charts for </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> your data.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><b><i><span style="color: #274e13;"> </span></i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 1. Different types of charts like Bar, Line, XY, Pie, Area, </i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> Radar, Scatter, Bubble, Meter, Bar/Line can be created</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 2. You can also customize your chart settings</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFOdaoaTNIuFqe6uASSBY9jtGcSnn1ZSDewB_ZEEsPYr7mznLPvLbzGkJAQMmAZvwPnmlXq5X-e0elSwJFWypOmFyj_tv-if6D4ZPXhb9uWNA1eTBykFsXKwca9E7T40dqgoO4owCqqUvp/s1600/charttool.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFOdaoaTNIuFqe6uASSBY9jtGcSnn1ZSDewB_ZEEsPYr7mznLPvLbzGkJAQMmAZvwPnmlXq5X-e0elSwJFWypOmFyj_tv-if6D4ZPXhb9uWNA1eTBykFsXKwca9E7T40dqgoO4owCqqUvp/s1600/charttool.png" height="168" width="320" /></a></i></b></span></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>5. </b><a href="http://convert-video-online.com/" style="font-weight: bold;">Video/Audio Converter</a><b> - </b><i>http://convert-video-online.com/</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b>You can convert Video/Audio files to different </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> formats using this site.</span><br />
<br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><b><i><span style="color: #274e13;"> 1. Video Formats Available - mp4, avi, flv, 3gp, Apple</span></i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> Android, etc..</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 2. Audio Formats Available - mp3, wav, Iphone rintone, </i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> m4a, flac, ogg, amr</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> 3. Also options like Video Cutter, Audio Cutter, </i></b></span><br />
<b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif;"><i> Audio Joiner,</i></b><b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif;"><i>and Voice Recorder are also available.</i></b><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span><b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif;"><i></i></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxN9TLIUdQrLgqm8DAsTlv3U45hkaC4aiu-3D-ozlDR3QWeqVazQOetZ3BuJN5TQD1oUk7QB3QnUndbYDJLodLw_A4uO1FMmCxbD6-LHHDFHXiyPcwAnnAVvstmwbrkIiETzwdWWyiz5LF/s1600/video.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxN9TLIUdQrLgqm8DAsTlv3U45hkaC4aiu-3D-ozlDR3QWeqVazQOetZ3BuJN5TQD1oUk7QB3QnUndbYDJLodLw_A4uO1FMmCxbD6-LHHDFHXiyPcwAnnAVvstmwbrkIiETzwdWWyiz5LF/s1600/video.png" height="161" width="320" /></a></i></b></div>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">These tools are of great use in offices and other organizations.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Wait for Part 2 to explore more online tools..</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/calculator-tricks-in-windows-7.html">Calculator Tricks in Windows 7</a></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/02/make-browsing-safe-when-using-friends.html">Make Browsing Safe when using friend's system or in a Net Cafe</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/01/problem-steps-recorder.html"><span style="font-family: Trebuchet MS, sans-serif;">Problem Steps Recorder</span></a></li>
</ul>
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-11801129712289752762014-02-05T21:00:00.000+05:302014-02-10T18:41:39.456+05:30Download YouTube Videos<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLxZG9EONvaQf_J4ep1YMy61c8oIP-l3kWvXVrodMi1KWN8-2yRveIIwDWxuhThoy1V3atctP83k14ezj2zXYeOCd_5_gALOsZCPLQiV-dninMdVwVGGk0o-kmtJElCj1G9dhvZT3PR_HX/s1600/youtube.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLxZG9EONvaQf_J4ep1YMy61c8oIP-l3kWvXVrodMi1KWN8-2yRveIIwDWxuhThoy1V3atctP83k14ezj2zXYeOCd_5_gALOsZCPLQiV-dninMdVwVGGk0o-kmtJElCj1G9dhvZT3PR_HX/s1600/youtube.jpg" height="197" width="320" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Hello,</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Here's a very simple trick to download videos from YouTube without any Software Installation.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You can also download videos by using<b> Intenet Download Manager (IDM)</b>, but here in this trick , no software is required.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Steps</span></b><br />
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>1. </b>Open <a href="https://www.youtube.com/"><b>YouTube </b> </a>and play the video you need to Download.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Edit the <i style="font-weight: bold;">video url </i>on the address bar as shown below</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> If your address bar looks like this </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span><b><i><span style="color: #073763;"> </span><span style="color: #274e13;">https://www.youtube.com/watch?v=QGJuMBdaqIw</span></i></b></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><b><i><span style="color: #274e13;"><br /></span></i></b></span>
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #274e13; font-style: italic; font-weight: bold;"> </span><span style="color: #073763;">Just Add <b style="font-style: italic;">pwn </b>before <i style="font-weight: bold;">youtube </i>and press Enter as shown below</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="color: #073763;"> </span></span><span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i>pwnyoutube.com/watch?v=QGJuMBdaqIw</i></b></span><br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><i> See the Screenshots</i></span><br />
<br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> </i> Before :</b></span><b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhse8u-fV0VTupPCePHTQxJVTWSond4k6PCPzAxwXDKNoSGGeJpmmJSSkt9k96Ed20bi4WLRmKfs2_LoY9WaPBlsGEOeBMI0bboFGYQT_VeKeKOCOyPCKoI63w8JRqD59HjHDcDeK79XFu1/s1600/original.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhse8u-fV0VTupPCePHTQxJVTWSond4k6PCPzAxwXDKNoSGGeJpmmJSSkt9k96Ed20bi4WLRmKfs2_LoY9WaPBlsGEOeBMI0bboFGYQT_VeKeKOCOyPCKoI63w8JRqD59HjHDcDeK79XFu1/s1600/original.png" /></a></b><br />
<b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif; text-align: center;"><i></i></b><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i> </i>After :</b></span><b style="color: #274e13; font-family: 'Trebuchet MS', sans-serif; text-align: center;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgs9TZ4MIaP_ol-vaKfGVNoXaVreucrGRTwvhFbwvd6teQnJAYfeR0KB9tVbFl9ePMvEU1W85oc0HI94kiDb9ZM8qRAY2-TiSsPT-IIMS246POWJR1LdLz2_XXn6ALq5yvJNa9V4QTgIix/s1600/original.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgs9TZ4MIaP_ol-vaKfGVNoXaVreucrGRTwvhFbwvd6teQnJAYfeR0KB9tVbFl9ePMvEU1W85oc0HI94kiDb9ZM8qRAY2-TiSsPT-IIMS246POWJR1LdLz2_XXn6ALq5yvJNa9V4QTgIix/s1600/original.png" height="38" width="400" /></a></i></b></div>
<br />
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #274e13; font-family: Trebuchet MS, sans-serif;"><b><i><br /></i></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">3. Now you will be redirected to <a href="http://deturl.com/">deturl.com</a>.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJpvpM_dkhwxRF8KxfkAaOA-VbtIV5qckYHoNgTkkkeFUz5a2hmpQEQqoRawvKZPN6KIt9oa7TvfmRBXaXoo1GvAdjFBa2GTcbZmNfVZZbL_Y-hwj4j06zLpnwd84NfvsKANDQTp5fh-Ra/s1600/followurl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJpvpM_dkhwxRF8KxfkAaOA-VbtIV5qckYHoNgTkkkeFUz5a2hmpQEQqoRawvKZPN6KIt9oa7TvfmRBXaXoo1GvAdjFBa2GTcbZmNfVZZbL_Y-hwj4j06zLpnwd84NfvsKANDQTp5fh-Ra/s1600/followurl.jpg" height="265" width="400" /></a></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">4. You can download the video from different sites shown above.I chose <a href="http://en.savefrom.net/">SaveFrom</a> from</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the list and your download starts when you click on video Formats as shown in</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> the below image. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjByab8e0sLIAh7tkf6Uiq9PxGQliKY6L3_BUOSnwP3d84CYoJswvjDK_EvCNQvuP37CC1Xqb2w1EeZE_OUZG1bWnnX0F4_I-NEGfyDr25vb9HaBWkJx5kaPTcPX-Bo4ZkMPQeAXJPYsvA5/s1600/final.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjByab8e0sLIAh7tkf6Uiq9PxGQliKY6L3_BUOSnwP3d84CYoJswvjDK_EvCNQvuP37CC1Xqb2w1EeZE_OUZG1bWnnX0F4_I-NEGfyDr25vb9HaBWkJx5kaPTcPX-Bo4ZkMPQeAXJPYsvA5/s1600/final.jpg" height="120" width="400" /></a></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">5. Also you can download the <b>mp3 file </b>for the requested video from <b>deturl.com.</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b> </b><i>See the screenshot</i></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpZDO3ZFUIB7cOdOq5RuUvrpbcgtIs2MjGZwCua6ogo4TjhQvzafdGC0cVAtA12U6KRlMe43GLReeQfx4hVWGism1FkdsFj9m6UmGXh3tnhhxqIetfqQXNXztuEO8ZIz21XqGpKK8YoPZR/s1600/mp3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpZDO3ZFUIB7cOdOq5RuUvrpbcgtIs2MjGZwCua6ogo4TjhQvzafdGC0cVAtA12U6KRlMe43GLReeQfx4hVWGism1FkdsFj9m6UmGXh3tnhhxqIetfqQXNXztuEO8ZIz21XqGpKK8YoPZR/s1600/mp3.jpg" height="62" width="400" /></a></i></span></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Conclusion</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">See <a href="http://softsprogrammer.blogspot.in/2014/01/download-you-tube-video-mp3-online.html">Download Youtube video mp3 online</a> for more details on how to download mp3 file for a YouTube Video.</span></li>
</ul>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>See Also</b></span></div>
<div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/problem-steps-recorder.html">Problem Steps Solver</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/02/calculator-tricks-in-windows-7.html"><span style="font-family: Trebuchet MS, sans-serif;">Calculator Tricks in Windows 7</span></a></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="https://www.blogger.com/"></a><span id="goog_1287245999"></span><span id="goog_1287246000"></span><a href="http://softsprogrammer.blogspot.in/2014/01/windows-hidden-god-mode-folder.html">Windows Hidden god mode Folder.html</a></span></li>
</ul>
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> </span></div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-28274825241484690202014-02-04T19:36:00.000+05:302014-02-05T21:01:25.626+05:30Know your Computer's Gender<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<br />
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQoU6K9FQWb-mZCrtLezxc7iM5Eq61_q8APMPaun9QsObrHOsCW3Ayfc3Cgx0mcaJ5uS2pM7RsI2lYwq_Y59NLCGqU2bOY4rIcEpoMtsQl5jYuVFqqD8MejtPZI_lpcuZthp3bka3YF6H2/s1600/gender.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQoU6K9FQWb-mZCrtLezxc7iM5Eq61_q8APMPaun9QsObrHOsCW3Ayfc3Cgx0mcaJ5uS2pM7RsI2lYwq_Y59NLCGqU2bOY4rIcEpoMtsQl5jYuVFqqD8MejtPZI_lpcuZthp3bka3YF6H2/s1600/gender.jpg" height="219" width="320" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Friends,</b></span><br />
<br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Want to know whether your computer is<b> Male</b> or <b>Female. </b>Try the below:-</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Steps</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b></b></span><br />
<a name='more'></a><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span><br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Open <b>Notepad </b>and Copy the below code</span></li>
</ul>
<div>
<b> <span style="color: #7f6000;"><i> </i></span></b><span style="color: #7f6000;"><i>Dim speaks, speech</i></span></div>
<div>
<span style="color: #7f6000;"><i> speaks="Hello Softsprogrammer"</i></span></div>
<div>
<span style="color: #7f6000;"><i> Set speech=CreateObject("sapi.spvoice")</i></span></div>
<div>
<span style="color: #7f6000;"><i> speech.Speak speaks</i></span></div>
<div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now Save the file as<b> Gender.vbs (</b><i>Any name with .vbs extension will do</i><b>)</b></span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Dont forget to change the<b> Save As Type </b>to <b>All Files</b> before saving.</span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Run Gender.vbs and see who speaks a <b>Male </b>or <b>Female</b>.That gives you your <b>Computer's Gender</b>.</span></li>
</ul>
<div>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></b>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Conclusion</span></b></div>
</div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">This depends on the voice you have selected in<b> Microsoft Text to speech </b>options</span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">You may also like</span></b></div>
<div>
<ul style="text-align: left;">
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="https://www.blogger.com/"></a><span id="goog_1099332947"></span><span id="goog_1099332948"></span><a href="http://softsprogrammer.blogspot.in/2014/01/create-software-that-reads-text-talk-it.html">Create a Software that Reads Text (Talk-It)</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/how-to-create-virus-cd-drive-ejector.html">How to Create a Virus(CD Drive Ejector Virus)</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/animated-facebook-chat-codes.html">Animated Facebook Chat Codes</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/01/create-time-teller-software-in-20-secs.html"><span style="font-family: Trebuchet MS, sans-serif;">Create a Time Teller Software in 20-secs</span></a></li>
</ul>
</div>
</div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0tag:blogger.com,1999:blog-1097823140941068929.post-91821086522825282742014-02-03T18:26:00.000+05:302014-02-04T20:55:55.132+05:30Make Browsing Safe When Using Friend's System or In a Net Cafe <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: right;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiED7wVQ_7pHSlemv98XaU2WJwIkvicGolcijG1FVWkuhGqYqb6G7cwNeeDuQkVMEE-TNN1MqcfuSgPUe9wIyWUaqMNUtgY3SGLcIn0GXrSR4BhmQeDuUaFamq_Ee_qOL3bzWeM4IoMq8lp/s1600/safebrowsing.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiED7wVQ_7pHSlemv98XaU2WJwIkvicGolcijG1FVWkuhGqYqb6G7cwNeeDuQkVMEE-TNN1MqcfuSgPUe9wIyWUaqMNUtgY3SGLcIn0GXrSR4BhmQeDuUaFamq_Ee_qOL3bzWeM4IoMq8lp/s1600/safebrowsing.png" height="200" width="200" /></a></div>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Friends,</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">What should you do to make your browsing safer when you are using a friend's system or when you are in a Net Cafe.</span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>How to:</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"> <i> 1. Erase what you searched for?</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> 2. Keep the history unchanged.</i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i> 3. Temporarily disallow saving of Histories, Cookies, url names etc </i></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><br /></i></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>Description</b></span><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;">All browsers has a concept called <i style="font-weight: bold;">Private Browsing </i>which will not save histories, form entries, username, password, cookies and everything you browsed for.So follow the below trick to completely 'undo' what you have searched.</span><br />
<br />
<a name='more'></a><br /><br />
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b><br /></b></span>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><b>1. Google Chrome</b></span><br />
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Click Settings and Select <b><i>"New Incognito Window".<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHbzWUkKnymFq0uMtj6k4LGI8Y0SZCv_pfM202c13aZJcY16fOM0YInqIfW6MfgS-uEJJCPFmtI6gx1UWW4RphWeQonEVDsvE44bv0WqgyFTAGvdPuoOEBXpun5e4hb2LScacvKkKm2mpO/s1600/chrome1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHbzWUkKnymFq0uMtj6k4LGI8Y0SZCv_pfM202c13aZJcY16fOM0YInqIfW6MfgS-uEJJCPFmtI6gx1UWW4RphWeQonEVDsvE44bv0WqgyFTAGvdPuoOEBXpun5e4hb2LScacvKkKm2mpO/s1600/chrome1.png" height="158" width="320" /></a></div>
</i></b></span></li>
</ul>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><br /></i></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>
</i></b>
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now you will get a window like below and what all you search for will not be saved or you are in a safe search mode. <i style="font-weight: bold;"> </i></span></li>
</ul>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><br /></i></b><i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"></i>
<br />
<div class="separator" style="clear: both; text-align: center;">
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrLiCBgzekxI1iFgitm79PVU9cJc_ocG0YJLOq4wp0truvmMQ8PS01wgG6q09oCkincqPAAr5mB4W2YYKXm0P_EERmii7zas5GcdLJjSYr1uOkpctbIl2sEkOhDtWv2ILXBfWM4mfw5UDZ/s1600/chrome.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrLiCBgzekxI1iFgitm79PVU9cJc_ocG0YJLOq4wp0truvmMQ8PS01wgG6q09oCkincqPAAr5mB4W2YYKXm0P_EERmii7zas5GcdLJjSYr1uOkpctbIl2sEkOhDtWv2ILXBfWM4mfw5UDZ/s1600/chrome.png" height="73" width="320" /></a></i></div>
<i style="color: #073763; font-family: 'Trebuchet MS', sans-serif; font-weight: bold;">
</i>
<span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><i><b><br /></b></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
<b><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">2. Mozilla Firefox</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Click on <b>Firefox </b>button and select <b><i>"Start Private Browsing"</i></b></span></li>
</ul>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><br /></i></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYbsxedpcNRQNuK4TVTuOA5Wv9ctigcHFpFAvuSSYXZbMFs0A3qPAS9P_e5R9fv9RCdHaSJ_-HgBZObloqLzmB6EYUZMzrumCYYlplHXN2mXkZoHf-aaVIAnBRh7VM5lWt6w7aAG84vYWJ/s1600/firefox2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYbsxedpcNRQNuK4TVTuOA5Wv9ctigcHFpFAvuSSYXZbMFs0A3qPAS9P_e5R9fv9RCdHaSJ_-HgBZObloqLzmB6EYUZMzrumCYYlplHXN2mXkZoHf-aaVIAnBRh7VM5lWt6w7aAG84vYWJ/s1600/firefox2.png" height="197" width="320" /></a></i></b></div>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>
</i></b><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i><br /></i></b><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><i>
</i></b>
<br />
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now you will get a safe search window as given below</span></li>
</ul>
<br style="color: #073763; font-family: 'Trebuchet MS', sans-serif;" />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio4oZvayUX6dKW5UzdQI4z9YI7eGJC2TYnt_SfZwindYJiRdiAnoQxHCJfoJuK96GwJIXOzD_AiLEe8Vysc79ucTjvqofKGhxdjCMnLCgcvbpurF2qAeCjuaJsjyitCVjvBkTbatNi5JnM/s1600/firefox.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio4oZvayUX6dKW5UzdQI4z9YI7eGJC2TYnt_SfZwindYJiRdiAnoQxHCJfoJuK96GwJIXOzD_AiLEe8Vysc79ucTjvqofKGhxdjCMnLCgcvbpurF2qAeCjuaJsjyitCVjvBkTbatNi5JnM/s1600/firefox.png" height="74" width="320" /></a></div>
<br style="color: #073763; font-family: 'Trebuchet MS', sans-serif;" />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>3. Internet Explorer</b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Click <b>Safety </b>Menu and select<b> "InPrivate Browsing"</b></span></li>
</ul>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU22ToSR08q5cI6GqkCw65SxgOLI6JEkihF1j9scSgBjVueuYCkpd3irxqjRN_hOH8n2LquIOTcRmMquJxOdWfWupVWTCaoKd2KA1lo7KGz5zGR-wR5erqqigieLG3DAbrSzjIheWYtTRO/s1600/explorer1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU22ToSR08q5cI6GqkCw65SxgOLI6JEkihF1j9scSgBjVueuYCkpd3irxqjRN_hOH8n2LquIOTcRmMquJxOdWfWupVWTCaoKd2KA1lo7KGz5zGR-wR5erqqigieLG3DAbrSzjIheWYtTRO/s1600/explorer1.png" height="210" width="320" /></a></b></div>
<b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;">
</b><b style="color: #073763; font-family: 'Trebuchet MS', sans-serif;"><br /></b><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ul>
<li style="text-align: left;"><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">Now do safe search on the window you get which looks exactly like the below one</span></li>
</ul>
<br style="color: #073763; font-family: 'Trebuchet MS', sans-serif;" />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLHXLeg8P99EMY51e1Kd0l0bCMX3pZPOM1iqXSf6Lb9Mq8waw5ZJb9Yqj6V8B3aWnJiA-EqE1U0uSAeOw2dM3_WTXnMMEgBrhsoz3VJXIeTDH_guOUReCSpkqDWDtenY6fS7hc3wfYOz7O/s1600/explorer2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLHXLeg8P99EMY51e1Kd0l0bCMX3pZPOM1iqXSf6Lb9Mq8waw5ZJb9Yqj6V8B3aWnJiA-EqE1U0uSAeOw2dM3_WTXnMMEgBrhsoz3VJXIeTDH_guOUReCSpkqDWDtenY6fS7hc3wfYOz7O/s1600/explorer2.png" height="87" width="320" /></a></div>
<br style="color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;" />
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
</div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><i>Enjoy Safe Browsing :-)</i></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><i><br /></i></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>Conclusion</b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">When you close the Safe Search Window, everything goes Normal and further New windows will be normal ones.</span></li>
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;">There will not remains any data that you have used that system for browsing with this trick.</span></li>
</ul>
<br />
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; color: #073763; font-family: 'Trebuchet MS', sans-serif; text-align: left;">
<b>You may also like</b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="color: #073763; font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/problem-steps-recorder.html">Problem Steps Recorder</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/the-flash-mind-reader-and-its-technique.html">The Flash Mind Reader and its Technique Revealed</a></span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><a href="http://softsprogrammer.blogspot.in/2014/01/play-video-as-ascii-output-in-vlc.html">Play Video as ASCII Output in VLC</a></span></li>
<li><a href="http://softsprogrammer.blogspot.in/2014/01/how-to-create-secured-folder-in-windows.html"><span style="font-family: Trebuchet MS, sans-serif;">How to Create a Secured Folder in Windows</span></a></li>
</ul>
<br />
<br /></div>
Softsprogrammerhttp://www.blogger.com/profile/18271110762779755120noreply@blogger.com0