Skip to main content

Posts

Showing posts from April, 2010

Auto Complete Feature for any control

SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=tts;Integrated Security=True"); //creat auto complete Collection AutoCompleteStringCollection collection = new AutoCompleteStringCollection(); //get the data from database SqlDataAdapter da1 = new SqlDataAdapter("select name from contacts ", con); DataTable dt1 = new DataTable(); da1.Fill(dt1); if (dt1.Rows.Count > 0) { for (int i = 0; i < dt1.Rows.Count; i++) { //add the student name into auto complete collection collection.Add(dt1.Rows[i].ItemArray[0].ToString()); } } //after adding the student names into auto complete collection bind the collection to Combobox toolStripComboBox1.AutoCompleteMode = AutoCompleteMode.Suggest; toolStripComboBox1.AutoCompleteSource = AutoCompl

Saving Text in Wav Format

Include the name space System.Speech saveFileDialog1.ShowDialog(); string str = saveFileDialog1.FileName; System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer(); synth.SetOutputToWaveFile(str+".wav" ); synth.Speak(textBox1.Text); MessageBox.Show("File Saved Successfully"); synth.Dispose();