[VB.NET]帮我看看这个问题!!!!!!!!

前端之家收集整理的这篇文章主要介绍了[VB.NET]帮我看看这个问题!!!!!!!!前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
帮我看看这个问题!!!!!!!! 我建了一个class类: Private name As String Public Property nm() As String Get Return Me.name End Get Set(ByVal value As String) Try If Me.name = value <= 10 And Me.name = value > = 1 Then Me.name = value End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Set End Property 我用下面的语句实现赋值和输出: Private Sub Button4_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button4.Click Dim nam As New Class1 nam.nm = 4 MessageBox.Show(nam.nm) End Sub 我怎么点击按钮的时候什么都不出而且提示我只能再1到10之间呀,怎么解决呀!!! __________________________________________________________________________ Set(ByVal value As String)改为 Set(ByVal value As int32) __________________________________________________________________________ 按下按钮就提示我出错,怎么回事呀!!!!! 如果不把 string 改成 int32 的话那怎么改呀!!!!!! __________________________________________________________________________ Public Property nm() As String Get Return Me.name End Get Set(ByVal value As String) Try If Val(Me.name = value) <= 10 And Val(Me.name = value) > = 1 Then Me.name = value End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Set End Property __________________________________________________________________________ 能问一下 leq_82() 你那用这个能正常输出吗? 我怎么还是什么都输不出来呀,至少有一点现在不弹错误了!!! 还是什么都输出来!!!!! __________________________________________________________________________ 该回复于2008-08-05 03:39:54被管理员或版主删除 __________________________________________________________________________ 能问一下 leq_82() 你那用这个能正常输出吗? 我怎么还是什么都输不出来呀,至少有一点现在不弹错误了!!! 还是什么都输出来!!!!! __________________________________________________________________________ Private Sub Button4_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button4.Click Dim nam As New Class1 nam.nm = "4 " ///////////////////加 " " MessageBox.Show(nam.nm) End Sub __________________________________________________________________________ 还有,你那个Class1是用来干什么的?能贴出代码来吗? __________________________________________________________________________ 晕,代码不就是上面那一段么?呵呵 __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/263885.html

猜你在找的VB相关文章