VB. NET method code for the progress bar

  • 2020-06-03 06:16:29
  • OfStack

1. Create progress bar:

<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=" Song typeface "></FONT><FONT face=" Song typeface "></FONT><FONT face=" Song typeface "></FONT><FONT face=" Song typeface "></FONT><br>
<b><font color="#800080" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; Please wait while data is being retrieved ...</font></b>
<table align="center">
<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">&nbsp;</span>
<span id="progress2">&nbsp;</span> <span id="progress3">&nbsp;</span> <span id="progress4">
&nbsp;</span> <span id="progress5">&nbsp;</span> <span id="progress6">&nbsp;</span>
<span id="progress7">&nbsp;</span> <span id="progress8">&nbsp;</span> <span id="progress9">
&nbsp;</span> <span id="progress10">&nbsp;</span> <span id="progress11">&nbsp;</span>
<span id="progress12">&nbsp;</span> <span id="progress13">&nbsp;</span><span id="progress14">&nbsp;</span><span id="progress15">&nbsp;</span>
<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() {
if (progressAt > progressEnd) progress_clear();
else document.getElementById('progress'+progressAt).style.backgroundColor = progressColor;
progressTimer = setTimeout('progress_update()',progressInterval);
function progress_stop() {
//progress_update(); // start progress bar

2. Set the query button property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Place the user code for the initialization page here 
If Not IsPostBack The
but_find.Attributes.Add("onClick", "Lay1.style.visibility='';progress_update();")
End If
End Sub

Sign up for the javascript script

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. Called in the query button click event

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='hidden';progress_stop();") ' Close the progress bar code 
End Sub

Related articles: