Method Code for VB. NET progress bar

Source: Internet
Author: User
Tags button attributes

1. Create a progress bar:
Copy codeThe Code is as follows:
<DIV id = "Lay1" style = "Z-INDEX: 1; LEFT: 1%; VISIBILITY: hidden; WIDTH: 99%; CURSOR: crosshair; POSITION: absolute; TOP: 32px; HEIGHT: 95%; BACKGROUND-COLOR: # ffffff "> <FONT face =" "> </FONT> <FONT face = ""> </FONT> <br>
<B> <font color = "#800080" size = "2"> & nbsp; retrieving data. Please wait... </font> </B>
<Table align = "center">
<Tr>
<Td>
<Div style = "BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: black 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8pt; PADDING-BOTTOM: 2px; BORDER-LEFT: black 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: black 1px solid "> <span id =" progress1 "> </span>
<Span id = "progress2"> </span> <span id = "progress3"> </span> <span id = "progress4">
</Span> <span id = "progress5"> </span> <span id = "progress6"> </span>
<Span id = "progress7"> </span> <span id = "progress8"> </span> <span id = "progress9">
</Span> <span id = "progress10"> </span> <span id = "progress11"> </span>
<Span id = "progress12"> </span> <span id = "progress13"> </span> <span id = "progress14"> </span> <span id = "progress15"> </span>
</Div>
</Td>
</Tr>
</Table>
<Script language = "javascript">
Var progressEnd = 15; // set to number of progress <span>'s.
Var progressColor = 'blue'; // set to progress bar color
Var progressInterval = 300; // set to time between updates (milli-seconds)
Var progressAt = progressEnd;
Var progressTimer;
Function progress_clear (){
For (var I = 1; I <= progressEnd; I ++) document. getElementById ('progress' + I). style. backgroundColor = 'transparent ';
ProgressAt = 0;
}
Function progress_update (){
ProgressAt ++;
If (progressAt> progressEnd) progress_clear ();
Else document. getElementById ('progress' + progressAt). style. backgroundColor = progressColor;
Progresstout = setTimeout ('Progress _ update () ', progressInterval );
}
Function progress_stop (){
ClearTimeout (progresstout );
Progress_clear ();
}
// Progress_update (); // start progress bar
</Script>
</DIV>

2. Set query button attributes
Copy codeThe Code is as follows:
Private Sub Page_Load (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles MyBase. Load
'User code to place the initialization page here
If Not IsPostBack
But_find.Attributes.Add ("onClick", "Lay1.style. visibility =''; progress_update ();")
End If
End Sub

3. Register a javascript script
Copy codeThe Code is as follows:
Public Sub scriptjdt (ByVal objPage As System. Web. UI. Page, ByVal strValue As String)
Dim jb As String
Jb = "<script language = 'javascript '>" + strValue + "</script>"
ObjPage. RegisterStartupScript ("jdt_ OK", jb)
End Sub

4. Click the query button to call
Copy codeThe Code is as follows:
Private Sub but_find_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles but_find.Click
'Query data code
'----------------
Me. scriptjdt (Me, "Lay1.style. visibility = 'den den '; progress_stop ();")' Close the progress bar code
End Sub

Related Article

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.