VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 307,168 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,528 people online right now. Registration is fast and FREE... Join Now!




Is there a way to make an Array of buttons

 

Is there a way to make an Array of buttons, is there any way to do that

NoBrain

17 Jun, 2009 - 04:53 AM
Post #1

D.I.C Lover
Group Icon

Joined: 25 Mar, 2009
Posts: 1,214



Thanked: 39 times
Dream Kudos: 125
My Contributions
Hi all is there a way to make an arry of buttons in vb.net in VB6.0 there is a prop of buttons name Index but not in VB.NET so if there is some way to do that

it look something like this in 6.0

EG:
CODE


Private Sub cmbTest3810_Click(Index As Integer)
ISL3810(Index).SerialPort = cmbComm3810(Index).ListIndex + 1
end sub



User is offlineProfile CardPM
+Quote Post

 
Reply to this topicStart new topic
Replies(1 - 2)

bflosabre91

RE: Is There A Way To Make An Array Of Buttons

17 Jun, 2009 - 05:36 AM
Post #2

go sabres
****

Joined: 22 Feb, 2008
Posts: 676



Thanked: 13 times
My Contributions
what do you need to use the index number for? you can assign an index number to the Tag property of the button. or you can use a dictionary to hold a collection of buttons. not exactly sure what u need to do with it but let us know more detail and we can help u a little more.

CODE

Private dic As New Dictionary(Of Int16, Button)

User is offlineProfile CardPM
+Quote Post

NoBrain

RE: Is There A Way To Make An Array Of Buttons

17 Jun, 2009 - 06:46 AM
Post #3

D.I.C Lover
Group Icon

Joined: 25 Mar, 2009
Posts: 1,214



Thanked: 39 times
Dream Kudos: 125
My Contributions
ok so i got this tab control that got several tabs on each tab i got the same fields textbox combobox and other stuff now if it was 6.0 i will just copy and paste from one to other then in the code i will just use the index to know what tab is. i will use it to control several ports with diferent setings so i will want to look like this old 6.0 code just EG for a button hit

CODE

Public ISL3810(constMax3810) As CISL3810     ' it is a class '
Private Sub cmbTest3810_Click(Index As Integer)
Dim intSaveSerialPort
    intSaveSerialPort = 3810(Index).SerialPort
    3810(Index).SerialPort = cmbComm3810(Index).ListIndex + 1
    3810(Index).TestPrinter
    3810(Index).SerialPort = intSaveSerialPort
End Sub


i this case when i hit button with index 1 the printer i use in this tab will load his settings smile.gif i think it is easy to do it like this when you got 10 + tabs

This post has been edited by NoBrain: 17 Jun, 2009 - 06:53 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 06:31PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month