使用逗号分隔在文本框中添加值

时间:2016-03-07 09:43:27

标签: asp.net vb.net

我有一个名为textbox1的整数,这个id在每个按钮点击时获得不同的值(例如101)。只要单击该按钮,我就希望将这些值连接到以逗号分隔的101,102,103With Selection.Find .Text = "^m^m": .Replacement.Text = "^m": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = False: .MatchSoundsLike = False: .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll

1 个答案:

答案 0 :(得分:0)

我想我知道你的意思。这应该像你期望的那样工作:

public void Button_Click(object sender, EventArgs e)
{
    if(string.IsNullOrEmpty(textBox.Text)
    {
       textBox.Text = Id;
    }
    else 
    {
       textBox.Text += "," + Id;
    }
}