Results 1 to 16 of 16

Thread: [2008] New Here and New to VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Question [2008] New Here and New to VB

    Hi all
    Time for me to go red in the face is suppose.

    Anyway i have built a little programe (im proud of it lol)

    But for the life of me i cant add a link to a website with in the programme?

    I would guess some sort of command needs to go betwwen these lines?

    Code:
    Private Sub Command1_Click()
    
    End Sub
    But what code is it? I have searched for 2 days now and im guessing its so easy no one has written about it

    Any help would be greatly appreciated

    Also can adsense be added to software?


    Thanks All

    Mark

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2008] New Here and New to VB

    Welcome to the forums.
    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            System.Diagnostics.Process.Start(TextBox1.Text)
    End Sub
    With the desired web site being in the textbox. If you aren't using a textbox, change accordingly.

  3. #3
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [2008] New Here and New to VB

    ...Time for me to go red in the face is suppose....

    ....I have searched for 2 days now and im guessing its so easy no one has written about it...
    So long as you're here "for help" or "to help" and not to 1) get your homework done 2) have us build an entire project for you or 3) asking for malicious code; don't be worried about the questions you ask.

    As many here will tell you, we all started from the begining at one point or another.

    Good luck and welcome.

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Re: [2008] New Here and New to VB

    Quote Originally Posted by sevenhalo
    So long as you're here "for help" or "to help" and not to 1) get your homework done 2) have us build an entire project for you or 3) asking for malicious code; don't be worried about the questions you ask.

    As many here will tell you, we all started from the begining at one point or another.

    Good luck and welcome.
    LOL a little to old to be doing homework now !

    Thanks for the welcome im off to try the code

    Thanks
    Mark

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2008] New Here and New to VB

    I just noticed you listed 2008 as your version.

    Are you really using 2008? (Not that it matters, I'm just curious )

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Re: [2008] New Here and New to VB

    Ok still cant figure it out

    Once i know how to add links i will be ok i think...

    Let me explain in greater detail

    I want to add a picture to the software similar to a banner (this i have managed) then when its clicked i would like them redirected to a web page www.nethostuk.com

    If someone could show me this then i guess i can just change the endpoint to what ever other links i would like to add at a later date...


    Thanks and sorry to be a pain but i just cant figure it out

    Mark

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2008] New Here and New to VB

    As I said, if you are not using a textbox, then change the control accordingly. Your picture is being housed in something, right? A PictureBox maybe?

    They have click events, so just move the code there and change the name to whatever you are calling your picturebox. And change the code to
    Code:
    System.Diagnostics.Process.Start("http://www.nethostuk.com")

  8. #8
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [2008] New Here and New to VB

    Maybe we should take a step back and ask if this is a WebForm or WinForm?

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2008] New Here and New to VB

    Quote Originally Posted by sevenhalo
    Maybe we should take a step back and ask if this is a WebForm or WinForm?
    Good point.

    So, what are we dealing with here nethostuk?

  10. #10

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Re: [2008] New Here and New to VB

    Web form i think ?

    I have tried the code again and guess what .....Nope i think perhaps i should stick to php and html, but im not givin up yet

    Her is what i have changed the code to

    Code:
    Private Sub Image2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Image2.Click
            System.Diagnostics.Process.Start ("http://www.nethostuk.com")
    End Sub
    Now the pic shows up fine but there is nothing when it is clicked ?

    Thanks again
    Mark

    And ive just checked my version its 6 not 8 so i need to change that

  11. #11
    Lively Member
    Join Date
    Nov 2005
    Posts
    104

    Re: [2008] New Here and New to VB

    If it's a web form, use a hyperlink (might be image hyperlink). You can assign it to have the image and the redirect link when it's clicked.

  12. #12

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Re: [2008] New Here and New to VB

    Quote Originally Posted by Sedna
    If it's a web form, use a hyperlink (might be image hyperlink). You can assign it to have the image and the redirect link when it's clicked.
    lol i have no idea how to do that,when i say im new i mean real new lol

    Maybe im not dealing with a form after all ?
    I think perhaps i should just give up

    Thanks
    mark

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] New Here and New to VB

    How did you start this project? From a Winforms application or a WebForms website?

    To navigate to a new page/site in asp.net you would use Repsonse.Redirect("http://yoursite.com")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    6

    Re: [2008] New Here and New to VB

    Ok Im going to have another try.
    Let me explain exactly what i have done thus far

    I opened microsoft visul studio6 then microsoft visula basic and am creating a .exe project:

    I have incleded pictures with this post!

    All i want to do is ad a link to an external webpage when clicked on, i dont care where it goes as once i see how to do it i can minipulate it anyway ?

    Im just to thick to work it out

    Thanks to all that have been helping

    mark
    Attached Images Attached Images   

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] New Here and New to VB

    Ah, ok. You are not using VB.NET 2008 but VB 6. I'll move your thread to the VB 6 forum.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: [2008] New Here and New to VB

    Here's a function to open a new browser window to a specified url:
    Code:
    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Public Sub OpenURL(pstrURL As String)
        Const SW_SHOWNORMAL As Long = 1
        
        ShellExecute 0&, "OPEN", pstrURL, vbNullString, vbNullString, SW_SHOWNORMAL
    End Sub
    Sample usage:

    OpenUrl "http://www.vbforums.com/showthread.php?t=482004"

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