Hi To all,i used progress bar control of 7 array i.e 0 to 7 ProgressBar(PB) with same name pb1 ,but how to write code for each .My code is working if i select 1 PB and there is any other event for pb that i should not click on pb it directly retrieve data from port ,thus we can load pb in a Form load which on loading it directly retrieve data.
Pls hlp in this. And i want to use array for storing data and recieving data that if i storing data from array 0 to 15 .so, if i store some command on 0th element of array that will trigger to the port and if any reply from port then it will store on the 0th element of the array and keep some timeout between this elements to retrieve and send .And can we keep this structure in a loop that we have not to press any key for it to start that it will start during form load.

Hi To all,i used progress bar control of 7 array i.e 0 to 7 ProgressBar(PB) with same name pb1 ,but how to write code for each .My code is working if i select 1 PB and there is any other event for pb that i should not click on pb it directly retrieve data from port ,thus we can load pb in a Form load which on loading it directly retrieve data.

To change the value of each progress bar you would type:

pb1([I]x[/I])[I].[/I]value = [I]value[/I]

Replace x with the number of the progress bar and value with the value you want it. So if you wanted to make the 3rd progress bar's value 50 you would type

pb1(3).value = 50

You can change other attributes of the progress bar the same way (like width, height etc.) for the width would do:

pb1([I]x[/I]).width = [I]value[/I]

To make the value of each progress bar the same you would put it in a loop like this (replace value with either a number or another variable):

For x = 0 to 7
pb1(x).value = [I]value[/I]
Next x

To retrieve a value you would use:

[I]something[/I] = pb1([I]x[/I]).value

Hope that answers your question about the progress bars :)

thanx Aaraggornn,it works my new question to u how to type cast integer value in float i wnt to calc this formula
int Recieved data
float batt voltage
batt vol.. =(float)Recieved data *0.0390625

i want batt vol .. value in float does vb support float type

Double is the equivalent for float

Here is the way to do that
Sub Convert2_Dbl()
Dim Recieved_data As Integer
Dim batt_voltage As Double
Recieved_data = 2
batt_voltage = CDbl(Recieved_data * 0.0390625)
End Sub

Thank u shasur this is code which iam using to send data and recieved dzta from port .what data coming from port is in AAA,EEE,LLL like this i want to use this value with the above formula it is not converting to integer ,string ,decimal
Dim ByteToSend(0 To 6) As Byte
Dim Buffer As Variant
Dim datain As Variant 'this is my recieved data
Dim dummy As String
Dim Battery As Double
Dim intdata As Variant
ByteToSend(0) = &H64 'Text5.Text
ByteToSend(1) = &H64 'Text5.Text
ByteToSend(2) = &H64 'Text5.Text
'ByteToSend(3) = &H64
'ByteToSend(4) = &H64
'ByteToSend(5) = &H61
Buffer = ByteToSend()
MSComm1.Output = Buffer
Do
dummy = DoEvents
Loop Until MSComm1.InBufferCount > 2
datain = MSComm1.Input
intdata = datain 'it giving 0 intdata
Debug.Print intdata
Battery = CDbl(intdata * 0.0390625)
ProgressBar4.Value = Val(Asc(Mid$(Battery, 1, 2)))'here it not display in the progess bar not even it text.
Text10.Text = Val(Asc(Mid$(Battery, 1, 2)))

thanxz for reply i will wait for u r rply thanx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.