首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VB如何将整型转换成TextBox类呢 小弟我的程序报错了

2012-10-12 
VB怎么将整型转换成TextBox类呢 我的程序报错了代码:Public Class Form1Dim s As IntegerPrivate Sub Form

VB怎么将整型转换成TextBox类呢 我的程序报错了
代码:
Public Class Form1

  Dim s As Integer



  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  s = 0
  Timer1.Interval = 1000
  Timer1.Enabled = False
  Timer2.Interval = 1000
  Timer2.Enabled = True
  End Sub

  Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

  End Sub

  Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  TextBox1.Text = Now
  End Sub

  Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  s = s + 1
  TextBox2 = s
  TextBox3 = s
  End Sub
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Timer1.Enabled = True
  End Sub

  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  Timer1.Enabled = False
  End Sub

  Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  TextBox2.Text = ""
  TextBox3.Text = "0"
  s = 0
  End Sub

  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  End
  End Sub

  Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

  End Sub
End Class

刚刚接触,希望能人帮忙改一下程序啊

错误提示:VB无法将类型“System.Int32”的对象强制转换为类型“System.Windows.Forms.TextBox”

应该是 s = s + 1
  TextBox2 = s
  TextBox3 = s
这一部分的错误 但是本人很菜 不知道怎么改
先去吃个饭 在线等 多谢啦

[解决办法]
TextBox2.Text = s.ToString();

热点排行