0
我有一個組合框和文本框。在文本框中的特定文本或單詞之後添加文本vb.net
組合框將有供用戶選擇的選項。
Textbox1有文本: - Troubleshooting Steps:
在文本框的屬性中設置。
如果用戶從組合框列表中選擇:Rebooted PC
,然後按下按鈕,它將在Troubleshooting Steps:
之後添加文本。
例子:Troubleshooting Steps: Rebooted PC
我希望能夠做的是添加多個選擇一個其他後。
例子:
Troubleshooting Steps: Rebooted PC- Problem returned after reboot- Replaced part
我做了一些谷歌上搜索,發現這個代碼,香港專業教育學院改爲做它的一部分。
但是,我有它的問題增加了最後選擇的文本Troubleshooting Steps:
推動選擇的第一個文本到最後。
發生了什麼例:
Troubleshooting Steps: (3rd)Replaced part- (2nd)Problem returned after reboot- (1st)Rebooted PC
代碼:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim text As String = TextBox1.Text
Dim index As Integer = text.IndexOf("Troubleshooting Steps:")
Dim countChars As Integer
countChars = "Troubleshooting Steps:".Length
If index >= 0 Then
text = text.Insert(index + countChars, ComboBox1.Text)
TextBox1.Text = text
End If
End Sub
嘿克里斯,多數民衆贊成在非常有趣的...但我需要在「故障排除步驟:」後的任何想法如何做到這一點? – Kenster
對不起,我錯過了一些解釋,我想第二個按鈕「跟進:」與第二個組合框/按鈕2。 – Kenster