473,396 Members | 2,013 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,396 software developers and data experts.

how to write ?

Hi! I am beginner of VB.net When I wrote with VB6, I copy and paste
some same controls, the IDE will paste a assay control such as
"label1(1),label1(2)......" . So I can control them total with the "for
.....Next".
But in VB.net When I do the same thing ,IDE will give me such as
"label1,label2......". then how can I do as the VB6?
for example:
In VB6

Private Sub Form1_Load
For i = 1 To 5
TextBox1(i) = ""
Nex
End Sub

In VB.net I just can write as follow:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

How can I wirte in VB.net with "for next"??

Thanks a Lot!!

Simon

Sep 10 '06 #1
5 1028
Unfortunately for all of us control array were scrapped int .NET.
However a few searches on this newsgroup or on MSDN will show ways to
mimic control arrays. But to answer your question try out the below
code. Be warned that the code can lead to runtime errors if you're not
careful typing, and can be difficult to maintain.

Dim i As Integer

For i = 1 To 5
Me.Controls("TextBox" & i).Text = ""
Next i

Thanks,

Seth Rowe

simon wrote:
Hi! I am beginner of VB.net When I wrote with VB6, I copy and paste
some same controls, the IDE will paste a assay control such as
"label1(1),label1(2)......" . So I can control them total with the "for
....Next".
But in VB.net When I do the same thing ,IDE will give me such as
"label1,label2......". then how can I do as the VB6?
for example:
In VB6

Private Sub Form1_Load
For i = 1 To 5
TextBox1(i) = ""
Nex
End Sub

In VB.net I just can write as follow:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

How can I wirte in VB.net with "for next"??

Thanks a Lot!!

Simon
Sep 10 '06 #2
Rowe,
Unfortunately for all of us control array were scrapped int .NET.
This is often misinterpreted in my opinion. There is not any more the
designer part of VB6 with the control properties.

There are now more control arrays in Net as there have ever been in VB6,
while mimic that array in even a better way is very easy
\\\.
Dim MySpecialControls() As Control = {Button1, TextBox1}
For Each ctr As Control In MySpecialControls
ctr.Text = "Hello"
Next
///

But this is only one of the it seems now endless possibilities to use conrol
arrays in .Net.

I hope this gives an idea,

Cor

"rowe_newsgroups" <ro********@yahoo.comschreef in bericht
news:11*********************@e3g2000cwe.googlegrou ps.com...
Unfortunately for all of us control array were scrapped int .NET.
However a few searches on this newsgroup or on MSDN will show ways to
mimic control arrays. But to answer your question try out the below
code. Be warned that the code can lead to runtime errors if you're not
careful typing, and can be difficult to maintain.

Dim i As Integer

For i = 1 To 5
Me.Controls("TextBox" & i).Text = ""
Next i

Thanks,

Seth Rowe

simon wrote:
>Hi! I am beginner of VB.net When I wrote with VB6, I copy and paste
some same controls, the IDE will paste a assay control such as
"label1(1),label1(2)......" . So I can control them total with the "for
....Next".
But in VB.net When I do the same thing ,IDE will give me such as
"label1,label2......". then how can I do as the VB6?
for example:
In VB6

Private Sub Form1_Load
For i = 1 To 5
TextBox1(i) = ""
Nex
End Sub

In VB.net I just can write as follow:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

How can I wirte in VB.net with "for next"??

Thanks a Lot!!

Simon

Sep 10 '06 #3

rowe_newsgroups wrote:
Unfortunately for all of us control array were scrapped int .NET.
However a few searches on this newsgroup or on MSDN will show ways to
mimic control arrays. But to answer your question try out the below
code. Be warned that the code can lead to runtime errors if you're not
careful typing, and can be difficult to maintain.

Dim i As Integer

For i = 1 To 5
Me.Controls("TextBox" & i).Text = ""
Next i

Thanks,

Seth Rowe

simon wrote:
Hi! I am beginner of VB.net When I wrote with VB6, I copy and paste
some same controls, the IDE will paste a assay control such as
"label1(1),label1(2)......" . So I can control them total with the "for
....Next".
But in VB.net When I do the same thing ,IDE will give me such as
"label1,label2......". then how can I do as the VB6?
for example:
In VB6

Private Sub Form1_Load
For i = 1 To 5
TextBox1(i) = ""
Nex
End Sub

In VB.net I just can write as follow:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

How can I wirte in VB.net with "for next"??

Thanks a Lot!!

Simon
Sep 10 '06 #4

Cor Ligthert [MVP] wrote:
Rowe,
Unfortunately for all of us control array were scrapped int .NET.

This is often misinterpreted in my opinion. There is not any more the
designer part of VB6 with the control properties.

There are now more control arrays in Net as there have ever been in VB6,
while mimic that array in even a better way is very easy
\\\.
Dim MySpecialControls() As Control = {Button1, TextBox1}
For Each ctr As Control In MySpecialControls
ctr.Text = "Hello"
Next
///

But this is only one of the it seems now endless possibilities to use conrol
arrays in .Net.

I hope this gives an idea,

Cor

"rowe_newsgroups" <ro********@yahoo.comschreef in bericht
news:11*********************@e3g2000cwe.googlegrou ps.com...
Unfortunately for all of us control array were scrapped int .NET.
However a few searches on this newsgroup or on MSDN will show ways to
mimic control arrays. But to answer your question try out the below
code. Be warned that the code can lead to runtime errors if you're not
careful typing, and can be difficult to maintain.

Dim i As Integer

For i = 1 To 5
Me.Controls("TextBox" & i).Text = ""
Next i

Thanks,

Seth Rowe

simon wrote:
Hi! I am beginner of VB.net When I wrote with VB6, I copy and paste
some same controls, the IDE will paste a assay control such as
"label1(1),label1(2)......" . So I can control them total with the "for
....Next".
But in VB.net When I do the same thing ,IDE will give me such as
"label1,label2......". then how can I do as the VB6?
for example:
In VB6

Private Sub Form1_Load
For i = 1 To 5
TextBox1(i) = ""
Nex
End Sub

In VB.net I just can write as follow:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

How can I wirte in VB.net with "for next"??

Thanks a Lot!!

Simon
Sep 10 '06 #5
"simon" <sp******@gmail.comschrieb:
When I wrote with VB6, I copy and paste
some same controls, the IDE will paste a assay control such as
"label1(1),label1(2)......" . So I can control them total with the "for
....Next".
But in VB.net When I do the same thing ,IDE will give me such as
"label1,label2......". then how can I do as the VB6?
Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Sep 10 '06 #6

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

Similar topics

10
by: Greg Hurlman | last post by:
I've got what I'm sure is a very simple problem. In an ASP page, I am trying to write out 4 fields from a recordset in succession: Response.Write rs("LastName") Response.Write rs("Suffix")...
1
by: techy techno | last post by:
Hii Just wanted to know how can I decorate my texboxes and Listmenu which is called from a JS file using the following code below: document.write("<SELECT NAME='cur2' ONCHANGE='cconv1();'>");...
2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
0
by: hari krishna | last post by:
hi all, My requirement is to generate xl reports throu Asp.Net without installing xl on web server computer. i am using Response object and wrtifile method as below. i dont know whether it is...
8
by: Ben | last post by:
Hi all, Just wondering how to write (using document.write) to a table cell. I have table with 3 rows and 3 colums. I want to write from within the Javascript to say third column of a first row....
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
11
by: Vmusic | last post by:
Hi, I am trying to write out an array of string variables to Notepad. I can't get SendKeys to accept the string variable only literal quoted strings. I DO NOT want the hassle of writing to a...
4
by: cbtechlists | last post by:
I have an ASP app that we've moved from a Windows 2000 to a Windows 2003 server (sql server 2000 to sql server 2005). The job runs fine on the old servers. Part of the app takes a recordset and...
0
by: kuguy | last post by:
Hi all, I'm new to the forums, so I hope this isn't in the wrong place... I have that "Software caused connection abort: socket write error" exception error that i've never meet before. ...
8
by: Mateusz Viste | last post by:
Hi, I am trying make some multimedia files playable from my website. So far, I am able to generate dynamically a new page containing the right <embed> section. However, when I load my script, it...
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
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
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,...
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.