| View previous topic :: View next topic |
| Author |
Message |
Golden Wing Grandmaster Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 905
|
Posted: Mon Feb 11, 2008 11:29 am Post subject: [TUT]How To Make Load Bar[TUT] |
|
|
-----------------------------How To Make Load Bar-------------------------
Program: Visual Basic 6
Need:
1.1 frame
2.1 shape
3.timer
Make 1 frame remove the name so its a rectangle put a shape inside make the width 1 of the shape then drag the shape until its as long as the frame copy the code then put width back to 1 put a timer then put" | Code: | | shape1.width = shape1.width +10 | " | Code: | | then put "if shape1.width="the width you copy" then msgbox"done" |
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Feb 11, 2008 12:36 pm Post subject: |
|
|
| are there no progress bar controls in VB6 somehow? |
|
| Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Mon Feb 11, 2008 12:48 pm Post subject: |
|
|
| Dude seriously. Use a progressbar. |
|
| Back to top |
|
 |
Golden Wing Grandmaster Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 905
|
Posted: Mon Feb 11, 2008 1:53 pm Post subject: |
|
|
who cares about the bar you can make your own
i dont even know the code for the progress bar _________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Feb 11, 2008 2:29 pm Post subject: |
|
|
betting on:
ProgressBarControlName.Value() |
|
| Back to top |
|
 |
Golden Wing Grandmaster Cheater
Reputation: 0
Joined: 29 Aug 2007 Posts: 905
|
Posted: Mon Feb 11, 2008 2:38 pm Post subject: |
|
|
| slovach wrote: | betting on:
ProgressBarControlName.Value() | thx  _________________
|
|
| Back to top |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Mon Feb 11, 2008 2:43 pm Post subject: |
|
|
Say I want to read a 1 gigabyte file. I want my buffer to be of 16 kilobyte.
So my loop will go for 65536 times ( 1gigabyte = 1073741824 bytes. 16 kilobyte = 16384 bytes. Divide them). My progress bar will go to 100 max. So, I'll have to divide the number of loops by 100 to get how often I'll update my progress bar (at 655 bytes). Here is an example code in c# (logic is the same, just need to do it differently in some other languages). It is basic logic. You could always set the maximum value of the progress bar to the length of the loop and update by every byte. There are a lot of ways to do this, so find one that you like and use it.
| Code: |
for (int i = 0,x = 655; i <= 65536; i++)
{
if (i == x)
{
progressbar.Value += 1;
x += 655;
}
}
|
|
|
| Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Mon Feb 11, 2008 2:59 pm Post subject: |
|
|
| killersamurai wrote: | Say I want to read a 1 gigabyte file. I want my buffer to be of 16 kilobyte.
So my loop will go for 65536 times ( 1gigabyte = 1073741824 bytes. 16 kilobyte = 16384 bytes. Divide them). My progress bar will go to 100 max. So, I'll have to divide the number of loops by 100 to get how often I'll update my progress bar (at 655 bytes). Here is an example code in c# (logic is the same, just need to do it differently in some other languages). It is basic logic. You could always set the maximum value of the progress bar to the length of the loop and update by every byte. There are a lot of ways to do this, so find one that you like and use it.
| Code: |
for (int i = 0,x = 655; i <= 65536; i++)
{
if (i == x)
{
progressbar.Value += 1;
x += 655;
}
}
|
|
you know this tut is for VB6 not C |
|
| Back to top |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Mon Feb 11, 2008 3:16 pm Post subject: |
|
|
Can't stand vb syntax, so I did it in a more soothing syntax. Logic is still the same, but it just needs to be in vb syntax.
| Code: |
Dim i As Integer = 0, x As Integer = 655
While i <= 65536
If i = x Then
progressbar.Value = progressbar.Value + 1
x += 655
End If
i += 1
End While
|
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Feb 11, 2008 6:15 pm Post subject: |
|
|
| killersamurai wrote: | Can't stand vb syntax, so I did it in a more soothing syntax. Logic is still the same, but it just needs to be in vb syntax.
| Code: |
Dim i As Integer = 0, x As Integer = 655
While i <= 65536
If i = x Then
progressbar.Value = progressbar.Value + 1
x += 655
End If
i += 1
End While
|
|
Still wont work with VB, but yea, good try either way lol.
Anyway, you can find the progressbar control in the common controls component. As for the code you would simply need to setup:
ProgressBar1.Min = xxx
ProgressBar1.Max = xxx
ProgressBar1.Value = xxx
In a loop like you are stating above to read from 0 to 65535 you could do:
| Code: | Dim x As Long
For x = 0 To 65535
ProgressBar1.Value = (x * 100) \ 65535
DoEvents
Next x |
Which would convert 65535 to a percentage between 0% and 100%. _________________
- Retired. |
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Feb 11, 2008 7:07 pm Post subject: |
|
|
Is that the right slash, Wicc? _________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Feb 11, 2008 9:51 pm Post subject: |
|
|
| samuri25404 wrote: | | Is that the right slash, Wicc? |
Yea. / in VB keeps a remainder while \ drops it.
1.77777 / 1 = 1.77777
1.77777 \ 1 = 2
1.49 \ 1 = 1 _________________
- Retired. |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Tue Feb 12, 2008 10:22 am Post subject: |
|
|
Dude.
What's the point if u dont bind it to a action?
... _________________
Intel over amd yes. |
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Thu Feb 14, 2008 5:29 pm Post subject: |
|
|
| killersamurai wrote: | Can't stand vb syntax, so I did it in a more soothing syntax. Logic is still the same, but it just needs to be in vb syntax.
| Code: |
Dim i As Integer = 0, x As Integer = 655
While i <= 65536
If i = x Then
progressbar.Value = progressbar.Value + 1
x += 655
End If
i += 1
End While
|
|
lol. Are you kidding? If you can understand vc then you can understand vb.
Edit: Thats called mod division. |
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Thu Feb 14, 2008 6:09 pm Post subject: |
|
|
You can also make the bar xp-style with a user control and with modules.
as Wiccaan said, nothing else than a Progrssbar.Min / Max value to define the limits, and control to make it increase is all needed to make one, also can be done with a simple label. _________________
|
|
| Back to top |
|
 |
|