Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

VB6.0 a test downloading file

Posted on 2006-05-02
11
Medium Priority
?
366 Views
Last Modified: 2008-01-09
hello

how can i make a box downloading but actually not downloading just a box with % of download i want set it to 1% - per 1 second ... 100 seconds example to finish the downloading .. actually is not a download just i would like to make an example like this
0
Comment
Question by:KingSencat
  • 5
  • 3
  • 3
11 Comments
 
LVL 3

Expert Comment

by:fullcontact
ID: 16587445
Use a progress bar, min = 0 max = 100

on a timer running every second

increase the progress bar value by 1 until it reaches 100.
0
 

Author Comment

by:KingSencat
ID: 16587606
i am newbie at vb6.0 can you explain with more details pls ?
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 16588281
Try this

Option Explicit

Private Sub Command1_Click()
    ProgressBar1.Max = 100
    ProgressBar1.Min = 0
    ProgressBar1.Value = 0
    Timer1.Interval = 1000
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If ProgressBar1.Value = ProgressBar1.Max Then
        MsgBox "Done"
    Else
        ProgressBar1.Value = ProgressBar1.Value + 1
    End If
End Sub
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:fullcontact
ID: 16593873
Exactly as GrahamSkan says.

Since your new to VB, if you want to increase the speed, simply reduce the timer1.interval. This figure is in milliseconds, hence 1000ms = 1sec.
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 16594828
Actually, you're also relatively new to this forum, so perhaps it should be mentioned that having 19 questions open is considered excessive. Can I suggest that you attend to any that are not waiting for further information?
0
 

Author Comment

by:KingSencat
ID: 16605020
Variable Not Found ..
0
 
LVL 3

Expert Comment

by:fullcontact
ID: 16605188
Have you actually created a form which contains a progressbar and a timer control?
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 16605923
Where?
0
 
LVL 3

Accepted Solution

by:
fullcontact earned 2000 total points
ID: 16606099
Try this, copy into note pad, saveas frmDownload.frm, this works fine

Then add to your vb project :-


VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmDownload
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   1650
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1650
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1
      Left            =   60
      Top             =   60
   End
   Begin MSComctlLib.ProgressBar ProgressBar1
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   3495
      _ExtentX        =   6165
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   1
   End
End
Attribute VB_Name = "frmDownload"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub Form_Load()
    ProgressBar1.Max = 100
    ProgressBar1.Min = 0
    ProgressBar1.Value = 0
    Timer1.Interval = 100
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If ProgressBar1.Value = ProgressBar1.Max Then
        Timer1.Enabled = False
        MsgBox "Done"
    Else
        ProgressBar1.Value = ProgressBar1.Value + 1
    End If
End Sub

0
 

Author Comment

by:KingSencat
ID: 16625511
Grahamskan= Method or data number not found..
0
 
LVL 3

Expert Comment

by:fullcontact
ID: 16625633
Where are you getting this error, this worked fine for me, have you added microsoft common controls to your controls list?
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question