. Net image counter

Source: Internet
Author: User
It's really strange. Why is there an error in my statement execution?

The cause of the error is that when counter> 10000, only the first four digits are displayed.

How can I solve this problem ........................

Source codeAs follows:

< % @ Page Language = " VB " Debug = " True " % >
< % @ Import Namespace = Namespace = " System. Io " % >
< Script Language = " VB " Runat = " Server " >
Function getfilename () Function Getfilename () As   String
Dim Fullpath As   String
Dim Position As   Integer
Fullpath = Request. servervariables ( " Path_translated " )
Position = Rev (Fullpath, " . " )
Getfilename = Mid (Fullpath, 1 , Position) & " CNT"
End Function

Sub page_load () 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 " >
Number of visitors: < Div ID = " Mydiv " Runat = " Server " > </ Div >
</ Form >
</ Body >
</ Html >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.