| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2508 人关注过本帖
标题:vb6 错误提示,编译错误。相同属性的属性过程定义不一致,或属性过程中包含 ...
取消只看楼主 加入收藏
smx_006
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2016-2-5
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
vb6 错误提示,编译错误。相同属性的属性过程定义不一致,或属性过程中包含可选参...
我本想自己定义一个对象,存储学生的成绩的,想要的形式如下
  chengji = stu.score("数学")
   stu.score("数学")=80,这是最理性的情况了。
我写的代码如下,请高手指教。错在了那里。

score类:

Option Explicit
Public name As String
Public value As Single

stu_score类:

Option Explicit
Private stu_score(1 To 9) As score


Private Sub Class_Initialize()
  Set stu_score(1) = New score
      stu_score(1).name = "语文"
  Set stu_score(2) = New score
      stu_score(2).name = "数学"
  Set stu_score(3) = New score
      stu_score(3).name = "英语"
  Set stu_score(4) = New score
      stu_score(4).name = "政治"
  Set stu_score(5) = New score
      stu_score(5).name = "历史"
  Set stu_score(6) = New score
      stu_score(6).name = "生物"
  Set stu_score(7) = New score
      stu_score(7).name = "物理"
  Set stu_score(8) = New score
      stu_score(8).name = "化学"
  Set stu_score(9) = New score
      stu_score(9).name = "地理"
End Sub
 
 Public Property Let someitems(ByVal strname As String, ByVal strvalue As Single)
      Dim i, doordog As Integer
       doordog = 0
      For i = 1 To 9
        If stu_score(i).name = CStr(strname) Then
            doordog = 1
            Exit For
        End If
      Next
      If doordog = 1 Then
        stu_score(i).value = strvalue
      End If
      If doordog = 0 Then
        MsgBox "属性" & strname & "不存在!", vbCritical
      End If
 End Property

Public Property Get someitems(ByVal strname As String) As score
         Dim i, doordog As Integer
       doordog = 0
      For i = 1 To 9
        If stu_score(i).name = CStr(strname) Then
            doordog = 1
            Exit For
        End If
      Next
      If doordog = 1 Then
        Set someitems = stu_score(i)
      End If
      If doordog = 0 Then
        MsgBox "属性" & strname & "不存在!", vbCritical
      End If
End Property
搜索更多相关主题的帖子: 数学 语文 
2016-02-05 23:26
快速回复:vb6 错误提示,编译错误。相同属性的属性过程定义不一致,或属性过程中 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.095380 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved