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

VB6 to VB.NET Indexing Help

Hey,

I am new to .NET and I would like to index a button control on my form
just like I used to be able to in VB6. In VB6 all I had to do was create one
control and new to something like

cmdButton()

and then I could copy it in the design window and refer to anyone of the
buttons by refencing its index like

cmdButton(43).Backcolor = vbRed

how could I accomplish the same thing in .NET

I was considering creating each button at runtime but it would be better if
I could design and place each button considering that there is over 80
different buttons and their placement is crucial.

thanks for the help in advance

Nov 21 '05 #1
5 1403
index is not longer to used in vb.net
use array
dim tb() as textbox
u can copy and paste it

Dim textboxGrid(8, 8) As TextBox
Private Sub makeGrid()
Dim txtBox As TextBox
Dim xPos, yPos As Integer

yPos = 45
For row As Integer = 0 To 8
xPos = 20
For column As Integer = 0 To 8
txtBox = New TextBox
txtBox.Parent = Me
txtBox.Location = New Point(xPos, yPos)
txtBox.BorderStyle = BorderStyle.FixedSingle
txtBox.Multiline = True
txtBox.Size = New Size(50, 50)
txtBox.Text = "0"
txtBox.TextAlign = HorizontalAlignment.Center
textboxGrid(row, column) = txtBox
Me.Controls.Add(txtBox)
xPos += 50
Next
yPos += 50
Next
End Sub
the u will have to do "for each" and "typeof"
regards

David S. Zuza wrote:
Hey,

I am new to .NET and I would like to index a button control on my form
just like I used to be able to in VB6. In VB6 all I had to do was create one
control and new to something like

cmdButton()

and then I could copy it in the design window and refer to anyone of the
buttons by refencing its index like

cmdButton(43).Backcolor = vbRed

how could I accomplish the same thing in .NET

I was considering creating each button at runtime but it would be better if
I could design and place each button considering that there is over 80
different buttons and their placement is crucial.

thanks for the help in advance


Nov 21 '05 #2
Thanks but I did not want to create them at runtime,

I need to edit them at design time but update them during runtime. Also,
they will be located at specific locations on the screen (not in a grid) and
they will differ in size.

There has to be a better way

David Zuza

"Supra" <su***@domain.invalid> wrote in message
news:ob********************@rogers.com...
index is not longer to used in vb.net
use array
dim tb() as textbox
u can copy and paste it

Dim textboxGrid(8, 8) As TextBox
Private Sub makeGrid()
Dim txtBox As TextBox
Dim xPos, yPos As Integer

yPos = 45
For row As Integer = 0 To 8
xPos = 20
For column As Integer = 0 To 8
txtBox = New TextBox
txtBox.Parent = Me
txtBox.Location = New Point(xPos, yPos)
txtBox.BorderStyle = BorderStyle.FixedSingle
txtBox.Multiline = True
txtBox.Size = New Size(50, 50)
txtBox.Text = "0"
txtBox.TextAlign = HorizontalAlignment.Center
textboxGrid(row, column) = txtBox
Me.Controls.Add(txtBox)
xPos += 50
Next
yPos += 50
Next
End Sub
the u will have to do "for each" and "typeof"
regards

David S. Zuza wrote:
Hey,

I am new to .NET and I would like to index a button control on my form
just like I used to be able to in VB6. In VB6 all I had to do was create
one control and new to something like

cmdButton()

and then I could copy it in the design window and refer to anyone of the
buttons by refencing its index like

cmdButton(43).Backcolor = vbRed

how could I accomplish the same thing in .NET

I was considering creating each button at runtime but it would be better
if I could design and place each button considering that there is over 80
different buttons and their placement is crucial.

thanks for the help in advance

Nov 21 '05 #3
Hi,

Maybe this will help.

http://www.windowsforms.net/default....mID=16&mid=142

Ken
-----------------------------

"David S. Zuza" wrote:
Hey,

I am new to .NET and I would like to index a button control on my form
just like I used to be able to in VB6. In VB6 all I had to do was create one
control and new to something like

cmdButton()

and then I could copy it in the design window and refer to anyone of the
buttons by refencing its index like

cmdButton(43).Backcolor = vbRed

how could I accomplish the same thing in .NET

I was considering creating each button at runtime but it would be better if
I could design and place each button considering that there is over 80
different buttons and their placement is crucial.

thanks for the help in advance

Nov 21 '05 #4
David,

This answer I gave some days ago on an almost ( a little bit more
complicated) same question

http://groups.google.com/group/micro...8f9e2f6?hl=en&

I hope this helps you as well,

Cor
Nov 21 '05 #5

Cor Ligthert [MVP] wrote:
David,

This answer I gave some days ago on an almost ( a little bit more
complicated) same question

http://groups.google.com/group/micro...8f9e2f6?hl=en&

I hope this helps you as well,

Cor

hi
i have created textbox during run time but when it comes the time of
saving the text it contain in sql database it shows null value in the
column
so can any one help me in saving that text.

also i am having problem with saving image ie photo in sql database
through .net program
so if you can help i will be really greatfull.

Nov 21 '05 #6

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

Similar topics

6
by: Michael Drumheller | last post by:
(If you're not interested in NumArray, please skip this message.) I am new to NumArray and I wonder if someone can help me with array-indexing. Here's the basic situation: Given a rank-2 array...
15
by: Jay | last post by:
Hello all. I've recently transferred our web sites from a Windows2000 server to a Windows2003 server. The transfer went almost flawless until I noticed that our search function isn't working...
1
by: Danny | last post by:
sorry for posting a question that has probably been posted hundreds of times, but i can't seem to find the answer i need...We're using a Sql Server 7.0 database and recently started getting timeout...
1
by: Perre Van Wilrijk | last post by:
Hi, I've got a full text index which works fine, SQLSERVER2000/WIN 2000 SERVER. The system requires to update indexes immediately, so I use a timestamp field to enable this. No problems so...
108
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would...
7
by: Ryan | last post by:
I have a bit of a problem with regards an indexing strategy. Well, basically there is no indexing strategy on a set of data I have at work. Now, I didn't create the design as I would have allowed...
4
by: Amar | last post by:
Hi All, I need to select data from a database table containing huge amount of data. Now I am storing data using one primary key and I am just using simple select statement, and this process...
4
by: twilliamson | last post by:
Hello, I am new to the Indexing Service and need a little help. My main goal is for my Windows XP Pro SP2 users is to be able to use the Windows Search (start, search) function to search for...
4
by: pratimapaudel | last post by:
I have tables in my database, it's sql server 2005. I heard some of them have indexing and some of them doesnot have indexing. If i want to check whether it has indexing or not how do i do? ...
2
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a server 2008 IIS 7.0 with indexing service installed. I have created the catalog and have a test page using these posts:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.