【问题标题】:Appending a text value from a combo box in WinForms从 WinForms 的组合框中附加文本值
【发布时间】:2020-01-11 17:23:35
【问题描述】:

所以目前我有一个包含三个值的组合框:

  • C
  • V
  • 简历

我创建了一个文本框并将其放在我的表单中,该表单获取从组合框中选择的数据,并显示选定的选项。此代码位于我的组合框中:

    txtCarVan.Text = cboCarVan.SelectedItem.ToString();

但是,当我将此文本框中的数据附加到我的 SQL 表中时,它看起来像这样:

System.Windows.Forms.TextBox,文本:C

我怎样才能使附加到字段中的唯一内容是选择的选项?

【问题讨论】:

  • System.Windows.Forms.TextBox 不是 WPF,而是 WinForms。请相应地编辑您的问题标签和标题。
  • 你要抢txtCarVan.Text

标签: c# sql winforms


【解决方案1】:

您很可能将 txtCarVan 而不是 txtCarVan.Text 传递到 SQL 中。

why is it i see System.Windows.Forms.TextBox, Text: every time i click insert Button?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-07
    • 1970-01-01
    • 2016-05-10
    • 2012-02-15
    • 2018-04-21
    • 1970-01-01
    • 2014-03-30
    相关资源
    最近更新 更多