| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 322 人关注过本帖
标题:新手咨询一个代码问题
只看楼主 加入收藏
s_xchen
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-5-16
收藏
 问题点数:0 回复次数:0 
新手咨询一个代码问题
    运行出错,提示hairclor=tbhair.Text eyeclor=tbeye.Text 出错,对非共享成员的引用要求对象引用;
为什么我不能引用textbox的text属性,我记得看过一个程序可以直接访问阿,真郁闷,那个帮我解惑,谢谢!

<HTML>
    <HEAD>
        <script language="VB" runat="server">
 CLASS cx
   public hairclor as string
   public eyeclor as string
   public birthday as date
 sub setmyself(Sender As Object, E As EventArgs)
 hairclor=tbhair.Text
 eyeclor=tbeye.Text
 birthday=date(tbbir.Text)
   end sub
 end class
sub  btSubmit_click(Sender As Object, E As EventArgs)
dim week as integer
week=birthday.dayofweek
response.write(hairclor&eyeclor)
end sub
 
        </script>
    </HEAD>
    <BODY bgcolor="#cccccc">
        <font size="5">Sam's Teach Yourself in 21 Days: Day 2, Exercise 1</font><hr>
        <p>
            <form runat="server" ID="Form1">
                hair:
                <asp:textbox id="tbhair" runat="server" />
                eye:
                <asp:textbox id="tbeye" runat="server" />
                <asp:button id="btSubmit" Text="Submit" OnClick="btSubmit_Click" runat="server" />
                <P>
                    birthday:
                    <asp:TextBox id="tbbir" runat="server"></asp:TextBox>
                    &nbsp;&nbsp;&nbsp;&nbsp;</P>
                <P>&nbsp;</P>
                <P>&nbsp;</P>
            </form>
    </BODY>
</HTML>
2011-05-16 23:13
快速回复:新手咨询一个代码问题
数据加载中...
 
   



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

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