【问题标题】:I can't send text from textbox HttpRequest c#我无法从文本框 HttpRequest c# 发送文本
【发布时间】:2021-08-11 16:46:19
【问题描述】:

我试过了,没问题。

但文本框无法发送文本。 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 的值?它是否设置为您认为的那样?拨打电话时doanDuoi2000是什么?

标签: c# httprequest


【解决方案1】:

提供textBox1.Text为文本框控件,默认创建后Text值会返回string.empty。

确保有调用

文本框1 = 新文本框();

这通常由你处理。表单的设计器文件。

【讨论】:

    猜你喜欢
    • 2020-02-20
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多