c# - 我无法从文本框 HttpRequest c# 发送文本
问题描述
我试过这个,没关系。
但是文本框无法发送文本。text is null
{
//Thread chiadoanduoi2000 = new Thread(chiadoanduoi200);
//chiadoanduoi2000.Start();
// chiadoanduoi2000.IsBackground = true;
string doanDuoi2000 = textBox1.Text;
HttpRequest http = new HttpRequest();
http.AddHeader("apikey", "xxx");
http.AddParam("input", "soem text here");
http.AddParam("speed", "1.0");
http.AddParam("encode_type", "0");
http.AddParam("speaker_id", "3");
string auido = http.Post("https://api.zalo.ai/v1/tts/synthesize").ToString();
textBox1.Text = auido;
textBox2.Text = auido;
//File.WriteAllText("truyen.txt", outputTexts[i].ToString());
}
但无法从文本框中发送文本以请求 api
{
//Thread chiadoanduoi2000 = new Thread(chiadoanduoi200);
//chiadoanduoi2000.Start();
// chiadoanduoi2000.IsBackground = true;
string doanDuoi2000 = textBox1.Text;
HttpRequest http = new HttpRequest();
http.AddHeader("apikey", "xxx");
http.AddParam("input", doanDuoi2000);
http.AddParam("speed", "1.0");
http.AddParam("encode_type", "0");
http.AddParam("speaker_id", "3");
string auido = http.Post("https://api.zalo.ai/v1/tts/synthesize").ToString();
textBox1.Text = auido;
textBox2.Text = auido;
//File.WriteAllText("truyen.txt", outputTexts[i].ToString());
}
请帮助我,非常感谢。
解决方案
提供textBox1.Text是一个文本框控件,默认创建后Text值会返回string.empty。
确保有电话沿线
文本框1 = 新文本框();
这通常由你处理。表单的设计器文件。
推荐阅读
- python - 在python中将日期转换为列表
- docker - 一个运行 Apache 的容器内的多个站点:来自外部的虚拟主机?
- c# - 如何返回 DispatcherOperation
从模拟对象 - sql - SQL Server CTE 层次结构数据类型转换
- angular - 如何在 Angular 中翻译库而不在应用程序中初始化翻译服务?
- c++ - 无效密码导致无限显示循环
- batch-file - 如何从批处理文件运行多个命令?
- javascript - JS - 我可以导入具有多个文件的同名导出吗?
- c++ - 是否可以使用 std::pair 作为 std::set 的键而每个元素没有任何重复?
- raku - 实例化 Raku 类,并在构造函数中更新实例变量