Results 1 to 9 of 9

Thread: text linking to an object or a form?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    125

    text linking to an object or a form?

    okay. i made a label and change the forecolor to blue, and font made it underline...

    like this one:
    [FONT COLOR="BLUE"]Answers[/FONT]

    and the code is:
    VB Code:
    1. Private Sub lblLink_Click()
    2. frmAnswers.show
    3. End Sub

    is there another solution, option or recommendation? i mean any other simple way of making links to an object?....

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: text linking to an object or a form?

    Can you explain in few words what is it that you need to do?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    125

    Re: text linking to an object or a form?

    a hyperlink!

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: text linking to an object or a form?

    Technically it isn't a Hyperlink, as it isn't showing a webpage

    The way you show is the most basic way of showing the other object when you click your label.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    125

    Re: text linking to an object or a form?

    that's right, it is something similar...
    but i want is the best or shortest method in making a text linkable to a form.
    and what object should i use: a label? a textbox? or ?

    that "or ?" is what i am asking... if none, i would stick with my previous code...

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: text linking to an object or a form?

    OK, you made me think for a minute ...
    Here is what you can do:
    - set caption for selected label to whatever you want
    - set Tag property to be actual form's name that you want to launch
    - run the following code and let me know if it works for you:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     Label1.Caption = "Display Summary Form"
    5.     Label1.Tag = "Form2"
    6. End Sub
    7.  
    8. Private Sub Label1_Click()
    9. Dim frm As Form
    10.  
    11.     Set frm = Forms.Add(Label1.Tag)
    12.     frm.Show
    13.  
    14. End Sub
    There is a way to set "hand" cursor to a label but that would come later ...

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    125

    Re: text linking to an object or a form?

    not working...

    okay, just want to ask how to set "hand" cursor to a label?

  8. #8
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: text linking to an object or a form?

    Hand cursor is the easy part, however it might not work on pre Win2K systems:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Const IDC_HAND = 32649&
    4.  
    5. Private Declare Function LoadCursor Lib "user32" _
    6.         Alias "LoadCursorA" _
    7.         (ByVal hInstance As Long, _
    8.         ByVal lpCursorName As Long) As Long
    9.  
    10. Private Declare Function SetCursor Lib "user32" _
    11.         (ByVal hCursor As Long) As Long
    12.  
    13. Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    14.     SetCursor LoadCursor(0, IDC_HAND)
    15. End Sub
    Now back to the problem: what's not working? Show me what you've done so far.

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: text linking to an object or a form?

    Attached is a hand cursor in both ico and cur format. Just load one of them in the MouseIcon property of the Label and set the MousePointer property to 99-Custom.
    Attached Files Attached Files

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