473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Add Button to Tab Page (using code)

I'm using "Dim btn As New ButtonArray(Me)" to create a series of
buttons on my form. However, I'd prefer it if they were created on a
tab page of a tab control. Is this possible?

My code:
Dim X As Integer = 10
Dim Y As Integer = 10

Dim bttnCount As Integer = 1

TabPage2.Focus()

Dim btn As New ButtonArray(Me)
Dim iTest As Integer
For iTest = 0 To objDataView.Count - 1
btn.Add(objDataView(iTest)("ExtraType"))
btn(iTest).Size = New System.Drawing.Size(96, 56)
btn(iTest).BackColor = Color.White
btn(iTest).Name = "Button" & iTest
btn(iTest).Location = New Point(X, Y)
AddHandler btn(iTest).Click, AddressOf btn_Click

bttnCount = bttnCount + 1

X = X + 96

If bttnCount > 8 Then
Y = Y + 56
X = 10
bttnCount = 1
End If
Next

Nov 21 '05 #1
2 2423
Hi,

Try adding the button to the tabpage.

TabPage2.Controls.Add(btn(iTest))

AddHandler btn(iTest).Click, AddressOf btn_Click

bttnCount = bttnCount + 1
Ken
-------------------------
"Steve" <he*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I'm using "Dim btn As New ButtonArray(Me)" to create a series of
buttons on my form. However, I'd prefer it if they were created on a
tab page of a tab control. Is this possible?

My code:
Dim X As Integer = 10
Dim Y As Integer = 10

Dim bttnCount As Integer = 1

TabPage2.Focus()

Dim btn As New ButtonArray(Me)
Dim iTest As Integer
For iTest = 0 To objDataView.Count - 1
btn.Add(objDataView(iTest)("ExtraType"))
btn(iTest).Size = New System.Drawing.Size(96, 56)
btn(iTest).BackColor = Color.White
btn(iTest).Name = "Button" & iTest
btn(iTest).Location = New Point(X, Y)
AddHandler btn(iTest).Click, AddressOf btn_Click

bttnCount = bttnCount + 1

X = X + 96

If bttnCount > 8 Then
Y = Y + 56
X = 10
bttnCount = 1
End If
Next
Nov 21 '05 #2
I love you.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jeff | last post by:
I've searched the web for hours trying to figure out this problem and can't seem to find any pertinent answers. I have a website where the user starts on a login page, puts in their credentials and...
7
by: IntraRELY | last post by:
I am using the following command to launch and .NET VB Executable, which is a simple Windows Form (printCheckClient.exe). I am using a HyperLink Control and works perfect....
3
by: IntraRELY | last post by:
I need to attach the following 2 little scripts to an ASP.NET Button. I am having an issue with running both of the Attributes.Add. I can only get on to work at once. I have also tried to put them...
5
by: Justnew | last post by:
I have a button in my webform.aspx And I have a htm document or page. What I want is that when I click on the button I want to display the htm page. In other words it is just a back button ...
1
by: Divya | last post by:
Hello This is my 1st project where I have to create a Webcontrol. I have created a simple custom control with a button and 2 labels added to a panel. My problem is that the event handler that I...
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
7
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant"...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.