[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
Re: [2008] New Here and New to VB
Welcome to the forums. :wave:
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.
Re: [2008] New Here and New to VB
Quote:
...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.
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
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 :) )
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
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")
Re: [2008] New Here and New to VB
Maybe we should take a step back and ask if this is a WebForm or WinForm?
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?
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
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.
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
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")
2 Attachment(s)
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
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.
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"