.net image counter

真实奇怪了啊,为什么我的语句执行有错误呢?

错误的原因是,当counter>10000的时候,只能显示前4位。

请问怎样解决这个问题……………………

源代码如下:

<%@ page language="VB" Debug="true" %>
<%@ Import Namespace="System.IO"%>
<script language="VB" runat="server">
    
Function GetFileName() As String
        
Dim FullPath As String
        
Dim Position As Integer
        FullPath
=Request.ServerVariables("PATH_TRANSLATED")
        Position
=InstrRev(FullPath,".")
        GetFileName
=Mid(Fullpath,1,Position)&"cnt"
    End Function

    
    
sub Page_Load(sender As Object, e As EventArgs)
        
if not Page.IsPostBack() then
            
Dim i As Integer
            
Dim Img As Image
            
Dim Count As Integer
            
Dim Graph As string
            
Dim mystream As FileStream
            
Dim pathname,datastr As string
            
Dim strreadobj As StreamReader
            
Dim strwriteobj As StreamWriter
            
            pathname
=GetFileName()
            mystream 
=New FileStream(pathname,FileMode.OpenOrCreate,FileAccess.Read)
            strreadobj
=New StreamReader(mystream)
            datastr
=strreadobj.ReadLine()
            strreadobj.Close()
            
            Count
=CInt(datastr)+1
            
            
            
for i=1 to len(Count)
                Img
=New Image()
                Graph
=Mid(Count,i,1
                
if Graph="" then
                    Img.ImageUrl
="Images/0.gif"
                Else    
                    Img.ImageUrl
="Images/" & Graph & ".gif"
                    MyDiv.Controls.Add(Img)
                
end If
            
next    
            
            mystream
=New FileStream(pathname,FileMode.Open,FileAccess.Write)
            strwriteobj
=New StreamWriter(mystream)
            strwriteobj.
WriteLine(Count)
            strwriteobj.Close()
        
end if
    
End sub
        
                
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Text Counter</title>
</head>
<body>
<form runat="server">
    访问人数:
<div id="MyDiv" runat="server"></div>
</form>
</body>
</html>
posted @ 2004-09-05 13:08  On the road....  阅读(742)  评论(2编辑  收藏  举报