473,387 Members | 1,582 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,387 software developers and data experts.

VB.NET Loop through buttons to assign values

I would like to build a loop to change button properties, not using a case select.
Like this:


Dim i As Integer
Dim ButtonSizeW As Integer = 50
Dim ButtonSizeH As Integer = 50
For i = 0 To 50
Dim z As Integer = i + 1
Dim x As New Button
x = "Button" & z ' name of button to change
x.Size = New Size(ButtonSizeW, ButtonSizeH)
Next
' x = Button1 ' it works like this

Can you help?
Thanks
Eric
Nov 18 '06 #1
1 5744
Ok managed to work it out.


Dim i As Integer
Dim ButtonSizeW As Integer = 50
Dim ButtonSizeH As Integer = 50
Public arrButton As Array = Array.CreateInstance(GetType(Button), 7, 10)
Dim x As New Button


For i = 0 To 50
Dim z As Integer = i + 1
Dim x As New Button

x.Name = arrTranslationTables(T) + m_ControlCount.ToString()
x.Text = arrTranslationTables(T) + m_ControlCount.ToString()
arrButton(z,y) = x
Next

For i = 0 To 50
arrButton(z,y) .Size = New Size(ButtonSizeW, ButtonSizeH)
Next
Nov 18 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

23
by: Mark Anderson | last post by:
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test' must equate as true or false This doesn't work... x = 5; for (y=1; (y==5); y+=1) { alert(x * y); } ...nor does... x...
5
by: Jani Yusef | last post by:
Based on an interview question I heard of but did not know the answer to....... How do you find and remove a loop from a singly linked list? In a google groups search I found the following code...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
12
by: Danny Colligan | last post by:
In the following code snippet, I attempt to assign 10 to every index in the list a and fail because when I try to assign number to 10, number is a deep copy of the ith index (is this statement...
2
by: fniles | last post by:
I am using .Net 2003 and querying a SQL Server 2000 database. I read the database in a loop, but on every iteration I set the SQLCommand to new, set it, execute it, dispose and set it to nothing....
1
by: bhavanirayala | last post by:
Hi, How can I get the hash values without loop? i.e I want to assign the value of a first key to one variable based on the condition.If that condition falis i need to assign the second value...
2
by: remya1000 | last post by:
hai i'm using Vb.net. i'm creating 64 dynamic created buttons of 8 rows and 8 columns. And i have 1 Go button, 1 textbox. those were created dynamically. if i enter one number inside textbox and...
2
by: somacore | last post by:
VS2005, C# Windows Form I can't quite figure out how to do this, but i think I'm close. I have a groupbox which contains 8 radio buttons, and I need to figure out which one is checked for entry...
3
by: andersond | last post by:
I have a webpage that uses visible and hidden tables to create the effect of going from screen to screen. Because a user might want to go back and change previous selections I have a "previous page"...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.