473,507 Members | 8,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String to Progress Bar max value.

RP
I have a routine that returns one column value in string. This time I
need to get total records in a table. So this routine is returning it
in string. I want to convert this value to an appropriate data type
that can be set as a maximum value for progress bar.

I tried:

progressBar1.Maximum = Convert.ToInt64(FoundVal)

but it is not working. It generates error:

"Error 10 Cannot implicitly convert type 'long' to 'int'. An explicit
conversion exists (are you missing a cast?)"

Aug 26 '07 #1
4 3120
What is the value of FoundVal when this happens?
"RP" <rp*********@gmail.comwrote in message
news:11**********************@q5g2000prf.googlegro ups.com...
>I have a routine that returns one column value in string. This time I
need to get total records in a table. So this routine is returning it
in string. I want to convert this value to an appropriate data type
that can be set as a maximum value for progress bar.

I tried:

progressBar1.Maximum = Convert.ToInt64(FoundVal)

but it is not working. It generates error:

"Error 10 Cannot implicitly convert type 'long' to 'int'. An explicit
conversion exists (are you missing a cast?)"

Aug 26 '07 #2
RP
something like "46" or any number of records.

Aug 26 '07 #3
RP wrote:
progressBar1.Maximum = Convert.ToInt64(FoundVal)

but it is not working. It generates error:

"Error 10 Cannot implicitly convert type 'long' to 'int'. An explicit
conversion exists (are you missing a cast?)"
Look at the error. It is telling you that you have a "long" value,
which you are trying to put into an "int" value. It is also telling you
that the compiler will not implicitly convert from one to the other, but
that you can cast it explicitly if you want to.

Now, it's not at all clear to me that converting to an Int64 (same as
"long") makes sense anyway. Since the target is an Int32 (same as
"int"), you should just convert to an Int32 in the first place.

Then you'll have no compile error there.

Compiler errors are not always clear or directly helpful. But most of
the time they are. Take the time to look at what they say, and in many
cases you'll find the error is giving you very specific instructions on
what's wrong (in this case, mis-matched types).

Pete
Aug 26 '07 #4
RP wrote:
progressBar1.Maximum = Convert.ToInt64(FoundVal)
progressBar1.Maximum is an int so you should use

progressBar1.Maximum = Convert.ToInt32(FoundVal)

hth

--
Andre Prins
Twain Development
Aug 26 '07 #5

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

Similar topics

16
24969
by: Paul | last post by:
i have been working with vb6 for a while but never had the pleasure of using progress bars. That is until now, one of the programs i have written has just been modified so that large csv files of...
2
1773
by: Kurien Baker Fenn | last post by:
I would like to show the progress of an application using the progress bar in visual basics using the timer.Please help me. Thanks in advance.
4
12987
by: Raed Sawalha | last post by:
Dear, I have windows form , the form is using a class to do all tasks needed like this private void btnProcess_Click(object sender, System.EventArgs e) { btnProcess.Enabled = false;...
8
5177
by: Brian Henry | last post by:
I created a smooth progress bar with this code.. but if you update the values in a row quickly of it and watch it on screen it flickers... how would i change this to reduce the flickering?...
2
2936
by: Robert Smith | last post by:
Hello, I have a problem with my progress bar, as shown in the attached code, the values on the bar are incremented within a threaded timer event. The timer works fine and ticks all the way...
23
42085
ADezii
by: ADezii | last post by:
Many Access Users fail to realize that it has a built-in Progress Meter that can display the relative completion percentage of various processes. It is fairly limited, but nonetheless, does provide...
5
6921
by: CCLeasing | last post by:
For an application I'm creating I want to create a 'fake' progress bar. By fake I mean a progress bar that looks like it's doing something but actually isn't. I know philosophically this isn't...
7
2482
by: Andrew Poulos | last post by:
I'm creating a JSON string and passing it to a SCORM 1.2 compliant LMS thus: var tmp = {}; tmp.assess = assessScore; tmp.loc = location; tmp.progress = notes.topics.toString();...
1
1438
by: edinwoking | last post by:
Hi I have been struggling to get a toolbar to update its progress information from an event raised ina parallel for loop. I have tried using delegates to get it to work but it just hangs after...
0
7110
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...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
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...
1
5041
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
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...
0
1540
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.