win表格/数据库中的不同彩色文本取决于用户点击的按钮

时间:2016-05-05 16:52:42

标签: vb.net visual-studio

Here is a link to a picture of how the win form app looks

我在vb.net做自己的待办事项列表应用程序,我想以某种方式强调紧急任务。我想也许可以通过在用户点击紧急按钮时更改文本的颜色。请看上面的图片,这是我的每个按钮的代码。

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    'check if text was entered
    If TextBox1.Text.Trim = "" Then
        Exit Sub
    End If

    'insert input into the database
    Me.TableTableAdapter.Insert(TextBox1.Text.Trim)
    ' Clear the contents of the text box to allow re-entry.
    TextBox1.Clear()

    'refil data
    Me.TableTableAdapter.Fill(Me.DataSet1.Table)

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    'check if text was entered
    If TextBox1.Text.Trim = "" Then
        Exit Sub
    End If

    'insert input 
    Me.TableTableAdapter.Insert(TextBox1.Text.Trim)

    ' Clear the contents of the text box to allow re-entry.
    TextBox1.Clear()

    'refil data
    Me.TableTableAdapter.Fill(Me.DataSet1.Table)


End Sub

0 个答案:

没有答案