本文介绍了语音程序适用于vs2008,但不适用于2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个可以在Visual Studio 2008中正常运行的程序,但是
在2010 Visual Studio(在另一台计算机上)运行它时出现运行时错误
错误是对象引用未设置为对象的实例."
我添加了Microsoft speach libiraray和system.speach
这是程序的一部分
i have a program which works fine in visual studio 2008 but
i have got a run time error when i run it in 2010 visual studio (in another computer)
The error is "Object reference not set to an instance of an object."
i added the microsoft speach libiraray and system.speach
this is part of the program
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
using System.Speech.Synthesis;
using System.Speech.Recognition;
using System.Media;
using System.Globalization;
//using Microsoft.Speech.Recognition;
//using Microsoft.Speech.Synthesis;
.
.
.
public partial class Form1 : Form
{ SpVoice voice = null;
public Form1()
{
InitializeComponent();
}
private void FormLoad(object sender, EventArgs e)
{
voice = new SpVoice();
}
private void HellowClick(object sender, EventArgs e)
{
voice.Speak("Hello World!", SpeechVoiceSpeakFlags.SVSFDefault);//<---- here is the error
推荐答案
这篇关于语音程序适用于vs2008,但不适用于2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!