How to code a new button.

VB 2008 help please?

Page 1 of 1

6 Replies - 4762 Views - Last Post: 26 October 2009 - 09:55 AM Rate Topic: -----

#1 tomatbebo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-July 09

How to code a new button.

Post icon  Posted 26 October 2009 - 09:00 AM

Ok so i have visual basics 2008 and im making a webbrowser which i have doen before. but on this one i wanted to add tabs. So i wanted to do it show when the "Add new tab" button is click i will make a new tabpage and all the buttons from the prevous tabpage.

Basicly it would clone the other tabpage and name it a new one .

but i dont know how to code the new buttons.

my code is :
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim nt As New TabPage
		Dim nb As New Button
		nt.Parent = TabControl1
		nb.Parent = nt
		nb.Text = "Click me"
	End Sub


but i want to code nb (new button ^^^)

heres what i tried

Private Sub nb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb.Click
		'PREFORM ACTION
	End Sub


and guess what it didnt work . By the way i do know that i didnt actually put an action i did before :P

any help if you understood any of the above?

Is This A Good Question/Topic? 0
  • +

Replies To: How to code a new button.

#2 jcremeans11  Icon User is offline

  • D.I.C Regular

Reputation: 26
  • View blog
  • Posts: 250
  • Joined: 04-October 09

Re: How to code a new button.

Posted 26 October 2009 - 09:23 AM

Whats the exact error?
Was This Post Helpful? 0
  • +
  • -

#3 tomatbebo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-July 09

Re: How to code a new button.

Posted 26 October 2009 - 09:26 AM

Well i cant code the new button i made . i made it its there no the page but has not coding behind it . nothing to make it do an action. i need the code to define what it is and what its going to do see?
Was This Post Helpful? 0
  • +
  • -

#4 dzone41  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 46
  • View blog
  • Posts: 216
  • Joined: 21-August 09

Re: How to code a new button.

Posted 26 October 2009 - 09:31 AM

Make what you have already into a class....tabpage with buttons(the one that works)
Then you would programaticly add the tabpage with an instance of the new class on it.
I did the same with a folder browser....works great.
Was This Post Helpful? 1

#5 jcremeans11  Icon User is offline

  • D.I.C Regular

Reputation: 26
  • View blog
  • Posts: 250
  • Joined: 04-October 09

Re: How to code a new button.

Posted 26 October 2009 - 09:32 AM

Yeah i see. If you havent already, you need to make a tab control and that's where you'll put the code. I'm not sure of the exact phrase because im not at my actual computer but you'll want to make some thing like

Private Sub nb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb.Click
		newtab.open=true
	End Sub

This post has been edited by jcremeans11: 26 October 2009 - 09:33 AM

Was This Post Helpful? 1

#6 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,469
  • Joined: 29-May 08

Re: How to code a new button.

Posted 26 October 2009 - 09:52 AM

Read the tutorial: Build a control without using the GUI Designer
Was This Post Helpful? 0
  • +
  • -

#7 tomatbebo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-July 09

Re: How to code a new button.

Posted 26 October 2009 - 09:55 AM

Thanks for all the helps guys my probelm is solved.

no need for more help thanks :P
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1