Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - wimsettj

Pages: [1] 2
1
 Archie,

:) THANK YOU!!! It worked. The automated bar is up and running flawlessly!

Your AdvancedHMI is amazing.  Thank you for all your hard work on this awesome program and for your help in trouble shooting my issues.

2
Archie,

Thank you for the quick reply. I will give it a try tonight when I get off work. Does it matter where I insert this in the code?

3
I am getting this error "InvalidOperationException was unhandled" when switching from Form6 to my Main Form with a Form change button. It does not happen every time. Sometimes I can change 5 times in a row and other times I can't change once without the error.

My Form6 is opened by clicking any selection button on Forms 1 through 4. This action also transfers the name of the selection to a BasicLabel on From6. I don't know if the error is happening because the original form is still open in the background when I leave Form6 or if something else is going on.
This is what I'm using for Forms1-4
Code: [Select]
Public Class Form1

    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If components IsNot Nothing Then
            Dim drv As AdvancedHMIDrivers.IComComponent
            '*****************************
            '* Search for comm components
            '*****************************
            For i As Integer = 0 To components.Components.Count - 1
                If components.Components(i).GetType.GetInterface("AdvancedHMIDrivers.IComComponent") IsNot Nothing Then
                    drv = components.Components.Item(i)
                    '* Stop/Start polling based on form visibility
                    drv.DisableSubscriptions = Not Me.Visible
                End If
            Next
        End If
    End Sub

    Private DrinkName As String

    Private Sub LongIsland_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LongIsland.Click
        DrinkName = "Long Island"
        LoadForm6(DrinkName)
    End Sub

    Private Sub LongBeach_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LongBeach.Click
        DrinkName = "Long Beach"
        LoadForm6(DrinkName)
    End Sub
    Private Sub LoadForm6(ByVal DrinkName As String)
        Dim oForm As New Form6
        oForm.SetDrinkName = DrinkName
        oForm.Selection.Text = DrinkName
        oForm.ShowDialog()
        Me.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
I tried adding in the Me.Close() because the Form was staying open in the background but it doesn't seem to work.

My Form6 code
Code: [Select]
Public Class Form6

    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If components IsNot Nothing Then
            Dim drv As AdvancedHMIDrivers.IComComponent
            '*****************************
            '* Search for comm components
            '*****************************
            For i As Integer = 0 To components.Components.Count - 1
                If components.Components(i).GetType.GetInterface("AdvancedHMIDrivers.IComComponent") IsNot Nothing Then
                    drv = components.Components.Item(i)
                    '* Stop/Start polling based on form visibility
                    drv.DisableSubscriptions = Not Me.Visible
                End If
            Next
        End If
    End Sub

    Private DrinkName As String = ""

    Public WriteOnly Property SetDrinkName As String
        Set(ByVal value As String)
            DrinkName = value
        End Set
    End Property

    Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Any suggestions? I'm down to the wire on getting this project done on time.

4
Open Discussion / Re: Best way to select a drink for an automated bar
« on: October 03, 2014, 01:50:41 AM »
Decided to just make them use a button to change back to the selection screen after their drink is made rather than automatically switching.

5
Support Questions / Re: Help getting a Basic Button to change to new Form
« on: October 03, 2014, 01:48:43 AM »
I got it figured out. I used Me.Hide() Is there a big difference between Hide() & Close()? Didn't know if it would make that big of a difference one way or the other.

6
Open Discussion / Re: Best way to select a drink for an automated bar
« on: September 28, 2014, 08:35:43 PM »
Slight change. It turns out I have 2 open forms at this point in the program & I just need to close the current form "Drink Mixing" so I can go back to the previous "Drink selection" form when the PLC "Drink Done" bit goes high. Is this possible with a data subscriber?

7
Support Questions / Re: Help getting a Basic Button to change to new Form
« on: September 28, 2014, 04:59:08 PM »
Ok, so I figured out what my problem is but not how to fix it. I am going from one of my "Drink Selection" Forms to my "Drink Mixing" Form. When I do this I am not actually closing the first form and opening a second. The "Selection" form is staying open and the "Mixing" form is opening over the top of it. Then when I try and use the same type of code to move to a new form it gets confused and all my form buttons after the 2nd form change send me back to my "mixing" form.

What I need to do is have my "Return to Main Form" basic button close the current "Mixing" form, so I am back on the still open "Selection" form. Here is the code I'm currently using. Form1 is my "Selection Form" and Form6 is my "Mixing Form" I have removed the bit of code that has been giving me fits so there would be a clean starting point for a solution.
Code: [Select]
Public Class Form1
    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If components IsNot Nothing Then
            Dim drv As AdvancedHMIDrivers.IComComponent
            '*****************************
            '* Search for comm components
            '*****************************
            For i As Integer = 0 To components.Components.Count - 1
                If components.Components(i).GetType.GetInterface("AdvancedHMIDrivers.IComComponent") IsNot Nothing Then
                    drv = components.Components.Item(i)
                    '* Stop/Start polling based on form visibility
                    drv.DisableSubscriptions = Not Me.Visible
                End If
            Next
        End If
    End Sub

    Private DrinkName As String

    Private Sub LongIsland_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LongIsland.Click
        DrinkName = "Long Island"
        LoadForm6(DrinkName)
    End Sub

    Private Sub LongBeach_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LongBeach.Click
        DrinkName = "Long Beach"
        LoadForm6(DrinkName)
    End Sub

 Private Sub LoadForm6(ByVal DrinkName As String)
        Dim oForm As New Form6
        oForm.SetDrinkName = DrinkName
        oForm.Selection.Text = DrinkName
        oForm.ShowDialog()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
End Class

Code: [Select]
Public Class Form6
    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If components IsNot Nothing Then
            Dim drv As AdvancedHMIDrivers.IComComponent
            '*****************************
            '* Search for comm components
            '*****************************
            For i As Integer = 0 To components.Components.Count - 1
                If components.Components(i).GetType.GetInterface("AdvancedHMIDrivers.IComComponent") IsNot Nothing Then
                    drv = components.Components.Item(i)
                    '* Stop/Start polling based on form visibility
                    drv.DisableSubscriptions = Not Me.Visible
                End If
            Next
        End If
    End Sub

    Private DrinkName As String = ""

    Public WriteOnly Property SetDrinkName As String
        Set(ByVal value As String)
            DrinkName = value
        End Set
    End Property

    Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
   
    Private Sub ReturnDrink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReturnDrink.Click
    End Sub
End Class

"ReturnDrink" is the basic button that tells the PLC to clear the current drink recipe. I also need it to close the current form6. Any suggestions?

8
Open Discussion / Re: Best way to select a drink for an automated bar
« on: September 28, 2014, 12:20:20 AM »
I'm so close to finishing this thing up. Every thing is put together and ready to run. I'm just trying to tweak things a bit. The problem I'm having is I would like to have the form which is up during the making of the drink switch to my main form when the drink is done. Is this possible with a Datasubscriber? How would I go about this?

9
Support Questions / Help getting a Basic Button to change to new Form
« on: September 23, 2014, 10:59:30 AM »
Hello everyone,

I'm still working on my automated bar & I am just about ready for full functional testing but I am having an issue with some of my VB code. Previously I used the following code to have a basic button change to form6 and transfer a string to a basic label on form6 using this code:

 Private DrinkName As String
    Private Sub LongIsland_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LongIsland.Click
        DrinkName = "Long Island"
        LoadForm6(DrinkName)
    End Sub
 Private Sub LoadForm6(ByVal DrinkName As String)
        Dim oForm As New Form6
        oForm.SetDrinkName = DrinkName
        oForm.Selection.Text = DrinkName
        oForm.ShowDialog()
    End Sub

What I want to do now is use a Basic Button on form6 to change back to my main form. I tried the code below but it does nothing when I click the button:

Private Sub LoadMain()
        Dim oForm As New Main
    End Sub
 Private Sub ReturnDrink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReturnDrink.Click
        LoadMain()
    End Sub

I tried adding in this line:  oForm.ShowDialog() It got me to the main form when I pressed the button but then caused the form change buttons on the main form to jump back to form6 instead of going to the correct form. What have I got wrong?

10
Open Discussion / Re: Form button visibility question
« on: July 07, 2014, 11:45:52 AM »
Thank you for the response Archie. Until the new release comes out I am going to try hiding the Form button with a blank Basic label set to bit address. This should keep it hidden until the process is completed and is ready to move on.

11
Open Discussion / Form button visibility question
« on: June 29, 2014, 11:40:31 AM »
I'm still working on my automatic bar & I have 2 questions.

1: Is it possible to have a form button be visible/not visible based on a bit value on the PLC? The basic button has the PLCAddressVisible option, but I don't see it available for the Form button. Is there someway to do this in code?

2: Is it possible to have a basic button not visible based on 2 bit values using an OR statement like B3:0/1 OR NOT B3:0/5?

12
Bartendro as similar to my design but I added in a bit of this...           http://youtu.be/hJIkJ9x0-JQ

Quick Question, I'm trying to use a Select case routine to set a bit address, but when I try to build the project I end up with an error. Here is a bit of the code:

 Private Sub BasicButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BasicButton1.Click
        Select Case DrinkName
            Case "Tequila"
                B3:1/0
            Case "Gin"
                B3:1/1

Here is the error message:
Error   1   Syntax error.
Error   2   Label 'B3' is already defined in the current method/multiline lambda.
Error   3   Syntax error.
Error   4   Label 'B3' is already defined in the current method/multiline lambda.
Error   5   Syntax error.

What am I doing wrong?

13
I'm intrigued by the data base idea. It would be nice to be able to add or delete recipes without having to rewrite the code. I might take you up on your offer to help after I get this prototype up and running. The HMI is done except for an error message or 2 & I'm streamlining the PLC program now. My first attempt was too bulky and hard to navigate. Should have it up and working in a month or so. I would like to have it done sooner but my real job always gets in the way of the fun stuff.

14
@ Mikefly95, I took your idea and ran with it. It is working really well. In the Select Case routine is there a limit to the amount of cases you can use? I've got about 50 mixed drinks and 20 shots I want to make available. I didn't know if I would need to break them up into several Select Case routines or if I could put them all together.

15
Open Discussion / Re: Best way to select a drink for an automated bar
« on: April 26, 2014, 01:39:54 AM »
Thank you both for the suggestions. I will give them a shot and see which way works best for me. I am picking up a book on VB so maybe I can understand the mechanics a little better. I will keep you updated on the progress of this project.

So far I've got most of the ladder logic done. I have 16 small pumps to dispense drink ingredients from individual spouts on a rail over the bar. The cup will be placed on a small platform mounted to a linear rail which will move to each ingredient used in the drink then return to the start position when the drink is completed. When i get a bit further in the build I will try and post some pics.

Pages: [1] 2