473,800 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maximum property of ProgressBar

Hi,

I need advice on how to set the maximum property of my progress bar.

I read a huge file so I need a progress bar when I read it. However, I
don't know how many records are there in the file until I finish
reading it.

Anyone can advise me on how to set accurate maximum?

Thanks!
Jun 27 '08 #1
7 1179
On Mon, 2 Jun 2008 13:32:39 -0700 (PDT), Curious
<fi********@yah oo.comwrote:
>Hi,

I need advice on how to set the maximum property of my progress bar.

I read a huge file so I need a progress bar when I read it. However, I
don't know how many records are there in the file until I finish
reading it.

Anyone can advise me on how to set accurate maximum?

Thanks!
How about finding out the size of the file in bytes, then keeping
track of how many bytes you have read. Don't forget about the record
delimiter, which you may not see depending on how you read the file.
Jun 27 '08 #2
Curious,

I expect that you are talking about a text file, which is in fact fysical a
long string of characters.

In those are often CR or/and LF characters, but those can only be seen as
they are readed, and that is not your goal.

So see the solution from Jack as a very good alternative.

Cor

"Curious" <fi********@yah oo.comschreef in bericht
news:f7******** *************** ***********@c65 g2000hsa.google groups.com...
Hi,

I need advice on how to set the maximum property of my progress bar.

I read a huge file so I need a progress bar when I read it. However, I
don't know how many records are there in the file until I finish
reading it.

Anyone can advise me on how to set accurate maximum?

Thanks!
Jun 27 '08 #3
On Jun 2, 5:13*pm, Jack Jackson <jjack...@cinno vations.netwrot e:
On Mon, 2 Jun 2008 13:32:39 -0700 (PDT), Curious

<fir5tsi...@yah oo.comwrote:
Hi,
I need advice on how to set the maximum property of my progress bar.
I read a huge file so I need a progress bar when I read it. However, I
don't know how many records are there in the file until I finish
reading it.
Anyone can advise me on how to set accurate maximum?
Thanks!

How about finding out the size of the file in bytes, then keeping
track of how many bytes you have read. *Don't forget about the record
delimiter, which you may not see depending on how you read the file.
Hi Jack,

Thanks for the suggestion! Definitely this is do-able although I'll
need to calculate the number of bytes I have read in the loop.

Could you tell me how to calculate the number of bytes for each line
of string?
Jun 27 '08 #4
On Tue, 3 Jun 2008 07:36:10 -0700 (PDT), Curious
<fi********@yah oo.comwrote:
>On Jun 2, 5:13*pm, Jack Jackson <jjack...@cinno vations.netwrot e:
>On Mon, 2 Jun 2008 13:32:39 -0700 (PDT), Curious

<fir5tsi...@ya hoo.comwrote:
>Hi,
>I need advice on how to set the maximum property of my progress bar.
>I read a huge file so I need a progress bar when I read it. However, I
don't know how many records are there in the file until I finish
reading it.
>Anyone can advise me on how to set accurate maximum?
>Thanks!

How about finding out the size of the file in bytes, then keeping
track of how many bytes you have read. *Don't forget about the record
delimiter, which you may not see depending on how you read the file.

Hi Jack,

Thanks for the suggestion! Definitely this is do-able although I'll
need to calculate the number of bytes I have read in the loop.

Could you tell me how to calculate the number of bytes for each line
of string?
It depends how you are reading each line. I presume you get the line
in a string variable. If so, then var.Length is the number of chars.
If the method you use to read the lines hides the line termination
characters, you need to count them too. I think I would assume two
termination characters per line, but check for the count getting too
high in case there is only one termination character.

Jun 27 '08 #5
>
If the file is Unicode, then the number of bytes will be twice the
number of characters. I'm not sure how to determine that.
Which is absolute not important for your solution, it is about the length
and the progress, the absolute values are not relevant.

:-)

Cor

Jun 27 '08 #6
On Wed, 4 Jun 2008 06:14:55 +0200, "Cor Ligthert[MVP]"
<no************ @planet.nlwrote :
>>
If the file is Unicode, then the number of bytes will be twice the
number of characters. I'm not sure how to determine that.

Which is absolute not important for your solution, it is about the length
and the progress, the absolute values are not relevant.

:-)

Cor
It's very important.

Suppose the file contains 1000 bytes.

If the file contains Ascii characters, then (ignoring line ending
characters) the program will read 1000 characters.

If the file contains Unicode characters, then if the program reads the
file correctly (each Unicode character in the file becomes one string
character) the program will read 500 characters. If the program
doesn't deal with this, the progress bar will only go to 50%.
Jun 27 '08 #7
Jack,

The information given back is not in characters it is the size in bytes,
however as it were pears it would be the same.

The only thing you have to do then is see what is the progress in pears.

But that is not important for the progressbar, it only has to know what
percentage of the way to go is done.

Cor
"Jack Jackson" <jj******@cinno vations.netschr eef in bericht
news:8p******** *************** *********@4ax.c om...
On Wed, 4 Jun 2008 06:14:55 +0200, "Cor Ligthert[MVP]"
<no************ @planet.nlwrote :
>>>
If the file is Unicode, then the number of bytes will be twice the
number of characters. I'm not sure how to determine that.

Which is absolute not important for your solution, it is about the length
and the progress, the absolute values are not relevant.

:-)

Cor

It's very important.

Suppose the file contains 1000 bytes.

If the file contains Ascii characters, then (ignoring line ending
characters) the program will read 1000 characters.

If the file contains Unicode characters, then if the program reads the
file correctly (each Unicode character in the file becomes one string
character) the program will read 500 characters. If the program
doesn't deal with this, the progress bar will only go to 50%.
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1575
by: Job Lot | last post by:
I have added a ProgressBar control to StatusBar control and created a custom property as below, to show the properties of the ProgressBar in Property Window of StatusBar. <Browsable(True)> _ Public Property ProgressBar() As ProgressBar Get Return ProgressBar1 End Get Set(ByVal Value As ProgressBar)
3
5294
by: Thorbjørn Jørgensen | last post by:
Hi I have some problems understanding the properties for the scrollbar class. F.eks. how do I set the Maximum property in comparison to the Height property if I for example want to have the scroller to have half the size of the scrollbar? If the question is formulated a little weird, an explanation of the ScrollBar Maximum, Height and Value properties would be great? Regards Thorbjorn
2
6314
by: jez123456 | last post by:
Hi, thanks for the previous advice on progressbars with showing the percentage. I would now like to create a less clunky version. I.e at the moment my progressbar shows 7 separate steps. Some steps can take seconds to process, but others could take upto 10 minutes (leaving the users thinking nothing is happening!). Is there a way to show the progressbar smoothly increasing until the final step has finished instead of clunking it's way...
1
5428
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form (form called ProgressForm) and the built the dll. Then I reference this new assembly from within my asp.net applicaiton and tried to access Windows.Forms.ProgressBar from within the ProgressForm but apparently it doesn't work. Because it won't...
1
696
by: nobody | last post by:
Hi I'm currently developing a Windows application. At the start of the application I load several tables into datatables in a dataset. I also use a progressbar to show the user how much percent of the total is already loaded. But I do this in a dirty way: I increment the progressbar with the same number after each table, but not all tables contain the same amount of data. I solved this with starting an other thread to increment the...
0
1051
by: Aaron Pfeifer | last post by:
Hi, I'm currently running a load test in Visual Studio 2005 (Academic) / .NET 2.0 against a web service written in c# (.NET 1.1). However, I'm only able to hit the web service with a maximum of 2 simultaneous clients. Now I know about the System.Net maxConnection property for ConnectionManagement. However, setting this property does not seem to resolve the problem. I've got the same test application written in Visual Studio 2003 /...
2
2034
by: Lespaul36 | last post by:
I have a control that I have made that uses a custom class for storage of some of the information. I want it to display in the VS.Net 2003 property grid in the IDE like the Font property does, so a use can expand it and set the properties. How do I do this? Thanks in advance.
6
10708
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm using the VScrollBar and set it as follow: m_vScrollBar.Minimum = -19602; m_vScrollBar.Maximum = 0; m_vScrollBar.SmallChange = 1; m_vScrollBar.LargeChange = 1089; m_vScrollBar.Value = m_vScrollBar.Maximum; The scroll bar is set to start from the bottom.
4
2513
by: sivamoorthy | last post by:
how to use a progressbar in a one cpp file but defined in another header file. the function in which i am using is a static member function. how to use the progressbar inside the function code: file name : flash.cpp void CFlasher::OnStartDownload (void *pDublicate) { bValueRet = DeviceIoControl (hHandle, \ (DWORD) IOCTL_SCUSBDFU_DETACH, NULL, \
0
9553
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10509
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10039
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9095
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7584
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4152
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.