SIGN UP MEMBER LOGIN:    
ARTICLE

New Year Application using C#.Net

Posted by Prashanth Chindam Articles | C# Language January 03, 2011
Article to develop a windows application using C# .Net to wish a ‘Happy New Year’.
Reader Level:
Download Files:
 

Objective:

To develop a windows application using the Microsoft Speech Object Library in C# .Net to wish a 'Happy New Year'.

Steps:

1. Goto 'Project' Menu -> Select 'AddReference'-> Click on 'COM' tab.

Select 'Microsoft Speech Object Library' -> OK.

reference.png

Note: In order to make use of this COM component we have to include 'using SpeechLib' namespace in the code.

2. Design:


nyappdesign.png

Design the form as shown above with one Label, one TextBox and three Buttons.

3. Code:

using System;
using System.Windows.Forms;
using SpeechLib;
namespace newyearapp
{
    Public
partial class newyearapp : Form
    {  
        public newyearapp()
        {
            InitializeComponent();
        }
        string str1 = "wish you a happy and prosperous new year ", str2;
        SpVoice obj = new SpVoice(); 
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Length > 0)
            {
                str2 = str1 + textBox1.Text;
                obj.Speak(str2, SpeechVoiceSpeakFlags.SVSFDefault);
            }
            else
                obj.Speak(str1, SpeechVoiceSpeakFlags.SVSFDefault);
        }
        private void btnClear_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
        }
        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
     }
}

Output

We will hear new year wishes.


Login to add your contents and source code to this article
share this article :
post comment
 

Thanks for Ur observation ~ Ur's Prashanth Chindam

Posted by Prashanth Chindam Jan 03, 2011

here 'S' is missing obj.Speak(str2 ,SpeechVoiceSpeakFlags.SVSFDefault);

Posted by Sandeep Shekhawat Jan 03, 2011
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor