• 0

[VB.NET] Links and Buttons


Question

I don't know how to put a link on buttons and links in VB .net, can anyone help me out?.... ;)

Thanks! :D

Edited by gerry.74
Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

In VB.Net there is a Link URL custom control, in VB, youll need to declare a ShellExec function

Nope, you cannot save your program so it doesn't work without .NET...

Link to comment
Share on other sites

  • 0
In VB.Net there is a Link URL custom control, in VB, youll need to declare a ShellExec function

How do you do that? ShellExec function? I am very new at this.

Nope, you cannot save your program so it doesn't work without .NET...

But why? :cry: Do I need VB 6?

Link to comment
Share on other sites

  • 0
How do you do that? ShellExec function? I am very new at this.

I'll give you the quick way so nobody blasts me for being inefficient. ;) :p

System.Process.Start( yourLinkLabel.Text )

That works if your Text property is the actual URL you want to navigate to. If you store the URL text in a Link's LinkData property, it's a little more involved.

But why? :cry: Do I need VB 6?

Well, the executable you create when you compile you .NET app isn't really an executable in the traditional sense. It's a stub of intermediate language that the .NET framework JIT(just-in-time) compiles to machine specific binary executable code. Also, the supporting libraries are contained in the framework.

VB 6.0, while compiling to a native binary executable, still requires a runtime, but it is included in the OS since Windows 2000(I believe). Earlier OSes still need to have the MSVBVM60.dll.

Link to comment
Share on other sites

  • 0
System.Process.Start( yourLinkLabel.Text )

That works if your Text property is the actual URL you want to navigate to. If you store the URL text in a Link's LinkData property, it's a little more involved.

Can I do that with buttons?

I don't know the code side yet, I need someone to show me where to go with the GUI ;)

Thanks for your help!

I need someone to show me where to go with the GUI ;)

I told you I am new :p :shifty:

Link to comment
Share on other sites

  • 0

So, you just want a button that will launch a URL? I guess I was misunderstanding you. That code will work inside a click event of a button. You'll only need to provide the url in the Start method's arguments.

   ' inside you click handler
    System.Process.Start( "www.neowin.net" ) ' for example
End Sub

Link to comment
Share on other sites

  • 0

Title edited

^ Report it next time :yes: Or maybe you did, I'm not the moderator for this forum, so I wouldn't see it :unsure:

Link to comment
Share on other sites

  • 0

Thanks! :D

So, you just want a button that will launch a URL? I guess I was misunderstanding you. That code will work inside a click event of a button. You'll only need to provide the url in the Start method's arguments.

I want to like steps but in one program, so you click "next" and it goes to the next form..

Link to comment
Share on other sites

  • 0
System.Process.Start( yourLinkLabel.Text )

I never use that...

... cuz in "System" namespace is no "Process"...

The right code:

System.Diagnostics.Process.Start(yourLinkLabel.Text)

-- or of cource --

System.Diagnostics.Process.Start("https://www.neowin.net")

Link to comment
Share on other sites

  • 0
I never use that...

... cuz in "System" namespace is no "Process"...

The right code:

System.Diagnostics.Process.Start(yourLinkLabel.Text)

-- or of cource --

System.Diagnostics.Process.Start("https://www.neowin.net")

Is that for:

So I have my project open, so I added Window form and I have set up the welcome form. Than I added the button, and name it "Next", then I added another Window form, now how do I link them, so when I hit "Next" it goes to the next form. :D

Link to comment
Share on other sites

  • 0

ah i see. if the first form is form1 and the next is form2, try (just doubleclick the button to get the procedure with Handles written out for you)

Private Sub Button1_Click() Handles blah
      Form2.Show
      Me.Hide
End Sub

Link to comment
Share on other sites

  • 0
ah i see. if the first form is form1 and the next is form2, try (just doubleclick the button to get the procedure with Handles written out for you)

Private Sub Button1_Click() Handles blah
 ? ? ?Form2.Show
 ? ? ?Me.Hide
End Sub

Thanks for your help, you save me a lot of tim:D... :D

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.