Results 1 to 7 of 7

Thread: How would I know whether the link label was clicked at the runtime.

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    14

    How would I know whether the link label was clicked at the runtime.

    my code looks something like this:

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    curtime.Text = TimeValue(Now) 'curtime is label
    End Sub

    I have a link label on my form and I want to change the value of curtime when user clicks on the link label at the run time.
    something like this
    curtime.Text = newtime.text 'newtime is label
    I can do this coding in the link label's click event but I want newly assinged value of the curtime should be running when the form runs and this can happen only when I put the code in the timer event, that's why I want to check in the timer event itself whether the link label was clicked by user at run time.
    How should I do that.

    Or please tell me how to call timer sub routine.
    Plz explain.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How would I know whether the link label was clicked at the runtime.

    That is not VB6 code.... Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: How would I know whether the link label was clicked at the runtime.

    Do you mean the text of the link label should show the current time automatically like a clock after it is clicked on or does it show the current time once and stops until the user click again?
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  4. #4
    Addicted Member
    Join Date
    Apr 2011
    Posts
    223

    Re: How would I know whether the link label was clicked at the runtime.

    I believe you're asking that you want a running time (the label) to be constantly updating and upon clicking it, the current time when clicked will appear in the textbox?

    If so, just set a timer to 1000ms (one second) with something like lblTime.Text = TimeOfDay and on the click event of the label set txtTime.Text = lblTime.Text

    Don't forget to enable the timer, otherwise the time won't update.

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    14

    Re: How would I know whether the link label was clicked at the runtime.

    you are not understanding.Please just tell e is there any way I can test inmy code whether the link label was clicked.like:
    if LinkLabelIsClicked then
    code
    OR is there any way I can call timer sub rotine??

  6. #6
    Addicted Member
    Join Date
    Apr 2011
    Posts
    223

    Re: How would I know whether the link label was clicked at the runtime.

    I'm clearly not the only person who doesn't understand what you are trying to say. Perhaps rephrasing?
    Code:
    Public Class Form1
        Dim YourLabelWasClicked As Boolean = False
    
        Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
            YourLabelWasClicked = True
        End Sub
    End Class

  7. #7
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: How would I know whether the link label was clicked at the runtime.

    You can use the settings-file to write a value when the user has clicked the link-label. Make sure you check the Settings-file before you execute. I hope you understand what I'm trying to tell you.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width