Welcome to Dream.In.Code
Become a VB Expert!

Join 150,055 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,719 people online right now. Registration is fast and FREE... Join Now!




Number Synchronization

 
Reply to this topicStart new topic

Number Synchronization, Between Text Boxes, LCD and Totals

lvlister2007
12 Feb, 2008 - 01:12 AM
Post #1

New D.I.C Head
*

Joined: 6 Feb, 2008
Posts: 6

Hi I have a bit of a problem I have 4 text boxes one for each number of an lcd displaying the format of tenths, units, tens and hundreds, these count up from a timer and from these boxes they display a relevant figure in the lcd segment structure to form a coherent number.
I have a second console panel with text boxes in them which calculate different prices, tallies and such are calculated but the main thing is the prices and tallies on the console and not the same as the petrol pump itself but they work off the same timer and between the two sections they are only like 5 numbers adrift of each other but still i want them to be the same, here is the code for the main drive of the program.

CODE

Private Sub txtnumber_Change()
Dim Dispensed As Single
Dim Running As Boolean
Dim PriceToPay As Single
Dim Price As Single
Dim Value As Single

Running = True
PriceToPay = txtAmountToPay.Text
Price = (txtPricePerLitre2.Text / 10)
Dispensed = txtnumber.Text
Value = txtPricePerLitre2.Text

If txtPricePerLitre2.Text = 199.9 Then
    MsgBox ("Stop! You Have Exceeded The Price Per Litre Limit"), , ("Pumping Limit")
Else
Do While Dispensed = 100 And Running = True
Dispensed = Dispensed + 1
PriceToPay = Val(txtnumber.Text) * Price
Loop
If txtAmountOfLitres.Text = 100 Then
Timer1.Enabled = False
txtnumber.Text = 0
txtAmountOfLitres.Text = txtnumber.Text
Running = False

MsgBox ("You Have Exceeded The Pump Limit"), , ("Pumping Limit Reached")
End If
End If

txtnumber.Text = Format(Dispensed, "000.0")
txtAmountOfLitres.Text = Format(Dispensed, "000.0")
txtAmountToPay.Text = FormatCurrency(Value, "000.0")
txtTallyPetrol.Text = FormatCurrency(PriceToPay / 100, "000.0")

User is offlineProfile CardPM
+Quote Post

momamman
RE: Number Synchronization
24 Mar, 2008 - 06:38 AM
Post #2

New D.I.C Head
*

Joined: 24 Mar, 2008
Posts: 4

try mine i dnt wats wrong wiv urs i thnk its fine
CODE

Dim frmconsole As New frmconsole()
    Dim frmDigits As New Digits()
    Dim petrol As Double
    Dim ppl As Double
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub btnopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnopen.Click
        frmconsole.Show()
    End Sub

    Private Sub btngo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btngo.Click
        petrol = 0.0
        Timer1.Enabled = True
        lblready.Visible = False
        lblout.Visible = False
        lblinuse.Visible = True
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        petrol = petrol + 0.1
        txtlitres.Text = petrol
        txtprice.Text = (txtppl.Text * txtlitres.Text) / 100
    End Sub

    Private Sub btnstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstop.Click
        Timer1.Enabled = False
        lblready.Visible = False
        lblout.Visible = False
        lblinuse.Visible = True
    End Sub

    Private Sub txtppl_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtppl.TextChanged
        txtppl.Text = frmconsole.txtppl2.Text

    End Sub
End Class
..............................................and for the console..........................
Dim ppl As Double
    Dim frmpump As frmpump
    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblpay.Click

    End Sub

    Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
        txtppl2.Text = ppl
        frmpump.txtppl.Text = ppl



    End Sub

    Private Sub txtppl2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtppl2.TextChanged
        ppl = 0.0
        

    End Sub
End Class

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:26PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month