在继续之前使按钮等待用户输入

时间:2013-04-25 08:30:44

标签: vb.net button textbox wait

我遇到了麻烦,无法解决问题

我正在尝试单击一个按钮然后让用户在文本框7和8中键入输入,然后重复使用文本框7和8来获取接下来的两个值,并且一旦完成该行就完成了该行被绘制......

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
    Dim formGraphics As System.Drawing.Graphics

    Dim x1 As Integer
    Dim y1 As Integer
    Dim x2 As Integer
    Dim y2 As Integer

    x1 = TextBox7.Text
    y1 = TextBox8.Text

    'clears textbox values...
    TextBox7.Text = ""
    TextBox8.Text = ""

    'set focus to textbox7...
    TextBox7.Focus()

    x2 = TextBox7.Text
    y2 = TextBox8.Text

    formGraphics = Me.CreateGraphics()
    formGraphics.DrawLine(myPen, x1, y1, x2, y2)
    myPen.Dispose()
    formGraphics.Dispose()
End Sub

目前,在点击按钮之前需要首先填充文本框,我想要它反过来..

任何人都知道怎么做?

ussing VB.net ...

1 个答案:

答案 0 :(得分:0)

是否要处理textbox textchanged事件,以便每当文本框中的文本发生更改时,检查它是否符合条件?

http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.textboxbase.textchanged.aspx

您还需要将代码分解为几个不同的子例程