I am rewriting a VB6 program from scratch. In vb6 I had an index
commandbtton and was able to do use a for loop to make changes to the
entire group of button. For example the following code worked out ok
Dim i As Integer
For i = 0 To cmdButtn.Count - 1
With cmdButtn(i)
.ToolTipText = .Caption
End With
Next i
As per every other programmer I am trying not to use the upgrade
wizard. Is there an easy way to translate this in vb.net 12 880 Jo****@aol.com wrote:
I am rewriting a VB6 program from scratch. In vb6 I had an index
commandbtton and was able to do use a for loop to make changes to the
entire group of button. For example the following code worked out ok
Dim i As Integer
For i = 0 To cmdButtn.Count - 1
With cmdButtn(i)
.ToolTipText = .Caption
End With
Next i
As per every other programmer I am trying not to use the upgrade
wizard. Is there an easy way to translate this in vb.net
Here is one possible anser: http://msdn.microsoft.com/library/de...visualcnet.asp
The other is just to stick the buttons in an actuall array or a Generic
List (if you using 2005) and then you can iterate the list:
for each btn in buttonList
btn.text = "hi"
next
HTH,
--
Tom Shelton Jo****@aol.com wrote:
I am rewriting a VB6 program from scratch. In vb6 I had an index
commandbtton and was able to do use a for loop to make changes to the
entire group of button. For example the following code worked out ok
Dim i As Integer
For i = 0 To cmdButtn.Count - 1
With cmdButtn(i)
.ToolTipText = .Caption
End With
Next i
As per every other programmer I am trying not to use the upgrade
wizard. Is there an easy way to translate this in vb.net
I don't think you would call this "easy", but you might *manually* put
the buttons in an array...
<aircode>
'at Form scope
private mButtons() As Button = { _
cmdButton01, cmdButton02, cmdButton3, ..., cmdButtonN _
}
'Somewhere else in code
For Each B as Button In mButtons
B.ToolTipText = B.Caption
Next
</aircode>
HTH.
Regards,
Branco.
Control arrays have gone away. (Bummer, I used them, too.)
If you want to hit all the buttons on a form, you could do the
following. This sets the tooltiptext equal to the caption
on the button. The [caption] property has been replaced
by the [text] property.
This is recursive so if you have panels on your form or
some other kind of container, it checks the controls in
that container as well.
Private Sub SetButtonText(ByVal ctrlContainer As Control)
For Each ctrl As Control In ctrlContainer.Controls
If TypeOf ctrl Is Button Then
ctrl.ToolTipText = ctrl.Text
End If
'if control has children, call this function recursively
If ctrl.HasChildren Then
SetButtonText(ctrl)
End If
Next
End Sub
Robin S.
-------------------
<Jo****@aol.comwrote in message
news:s1********************************@4ax.com...
>I am rewriting a VB6 program from scratch. In vb6 I had an index
commandbtton and was able to do use a for loop to make changes to the
entire group of button. For example the following code worked out ok
Dim i As Integer
For i = 0 To cmdButtn.Count - 1
With cmdButtn(i)
.ToolTipText = .Caption
End With
Next i
As per every other programmer I am trying not to use the upgrade
wizard. Is there an easy way to translate this in vb.net
<Jo****@aol.comschrieb:
>I am rewriting a VB6 program from scratch. In vb6 I had an index
commandbtton and was able to do use a for loop to make changes to the
entire group of button.
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/>
Joseph
\\\
dim cmdButtn() as control = {Mybutton1, Mybutton2, MyMoreButton4}
For i as integer = 0 To cmdButtn.Count - 1
cmd(i).ToolTipText = cmd(i).Text
Next
///
I hope this helps,
Cor
Thanks for the replys. Can some explain why they were dropped?
On Fri, 24 Nov 2006 06:46:18 +0100, "Cor Ligthert [MVP]"
<no************@planet.nlwrote:
>Joseph
\\\ dim cmdButtn() as control = {Mybutton1, Mybutton2, MyMoreButton4} For i as integer = 0 To cmdButtn.Count - 1
cmd(i).ToolTipText = cmd(i).Text Next ///
I hope this helps,
Cor Jo****@aol.com wrote:
Thanks for the replys. Can some explain why they were dropped?
I'm not sure anyone knows the answer to that except MS :) But, I will
say this, that it is one of the few features I miss. There are lots of
other ways to get around it - but all of them require manual
intervention because the designer has no support for control arrays.
Maybe VB.NET 2008?
--
Tom Shelton
Joseph,
As I showed they are not dropped, every control has now its own control
collection as the form has too.
However the way they could be set in VB6 was in fact a little bit clumsy, it
was something special made only for forms.
Cor
<Jo****@aol.comschreef in bericht
news:89********************************@4ax.com...
Thanks for the replys. Can some explain why they were dropped?
On Fri, 24 Nov 2006 06:46:18 +0100, "Cor Ligthert [MVP]"
<no************@planet.nlwrote:
>>Joseph
\\\ dim cmdButtn() as control = {Mybutton1, Mybutton2, MyMoreButton4} For i as integer = 0 To cmdButtn.Count - 1 cmd(i).ToolTipText = cmd(i).Text Next ///
I hope this helps,
Cor
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
As I showed they are not dropped, every control has now its own control
collection as the form has too.
Well, would it really be a problem to provide support for control arrays in
the designer in addition to the features currently provided? I don't think
so.
However the way they could be set in VB6 was in fact a little bit clumsy,
it was something special made only for forms.
I don't think it was clumsy, it was simply VB6's way. With some
improvements I'd like to see a replacement in .NET too.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Herfried K. Wagner [MVP] wrote:
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
As I showed they are not dropped, every control has now its own control
collection as the form has too.
Well, would it really be a problem to provide support for control arrays in
the designer in addition to the features currently provided? I don't think
so.
However the way they could be set in VB6 was in fact a little bit clumsy,
it was something special made only for forms.
I don't think it was clumsy, it was simply VB6's way. With some
improvements I'd like to see a replacement in .NET too.
I fully agree with you Herfied. This was a nice feature of VB.CLASSIC,
that I would love to see implemented in .NET.
--
Tom Shelton
Tom,
You both don't need my opion in this I assume?
:-)
Cor
"Tom Shelton" <to*********@comcast.netschreef in bericht
news:11*********************@45g2000cws.googlegrou ps.com...
>
Herfried K. Wagner [MVP] wrote:
>"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
As I showed they are not dropped, every control has now its own control
collection as the form has too.
Well, would it really be a problem to provide support for control arrays in the designer in addition to the features currently provided? I don't think so.
However the way they could be set in VB6 was in fact a little bit
clumsy,
it was something special made only for forms.
I don't think it was clumsy, it was simply VB6's way. With some improvements I'd like to see a replacement in .NET too.
I fully agree with you Herfied. This was a nice feature of VB.CLASSIC,
that I would love to see implemented in .NET.
--
Tom Shelton
Cor Ligthert [MVP] wrote:
Tom,
You both don't need my opion in this I assume?
:-)
Cor
All opinions are welcome - as long as they are the same as mine :)
--
Tom Shelton This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: cpchan |
last post by:
According the documentation from Metalink, the following files are required
for the Oracle Upgrade from 8.1.6 to 8.1.7 :
u0801060.sql
c0801060.sql
a0801060.sql
i0801060.sql
utlip.sql
...
|
by: DickChristoph |
last post by:
Hi
I am interested in converting a Access 97 application to VB.Net (well okay
rewriting). This would be a VB.Net client with a SQL Server backend, as
opposed to my other alternative which would...
|
by: |
last post by:
Hello,
I bought Visual Studio 6.0 Professional several years ago as a college
student with the academic price/license. Microsoft's Upgrade Eligability
page (http://tinyurl.com/3mtga) does list...
|
by: sea |
last post by:
Hi, I have db2 workgroup 7.2 and am planning to upgrade to 8.1
workgroup server edition. Could someone please tell me if the order in
which I do this as listed below is correct?
ON THE SERVER...
|
by: DonLi |
last post by:
Hi,
I have a copy of Access 97 while my client uses Access 2000 which
supports Unicode. My client has ordered a copy of Access 2000 upgrade
for me, but the middleman, atomicpark.com is totally...
|
by: Kelt |
last post by:
I have a user who currently has Access 97 installed on her PC. She
has purchased a new PC and would like to have Access installed on it.
She would like to upgrade her current Access to Access...
|
by: pshindle |
last post by:
We have several machines currently running the DB2 V7 Run-time Client
that we would like to actually be running the App Dev Client. To
'upgrade' (within the same version) this client software can...
|
by: Jerry Derringer |
last post by:
Our company just upgraded to VS 2005 (and by the way, I love it!) I was able
to migrate the code for our product from VS2003 to VS2005 with only a few
snags, and it's working great now. However...
|
by: Goofy |
last post by:
I bought VS2003 in 2003 of course :)
Now I want to upgrade but I was wondering when you install an upgrade if it
A.) Requires that VS2003 be already installed
B.) Overwrites it or allows...
|
by: =?Utf-8?B?aHVyY29tYmU2?= |
last post by:
i have just upgraded to vista from xp, what i wanted to know was how to do
system recovery if i have any problems in the future,i had recovery discs for
xp,but all i have got for vista is the acer...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
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,...
|
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: 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...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |