升级问题 [英] Upgrade Question

查看:71
本文介绍了升级问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从头开始重写VB6程序。在vb6中我有一个索引

commandbtton并且能够使用for循环来更改

整组按钮。例如下面的代码确定好了

Dim i As Integer

For i = 0 to cmdButtn.Count - 1

with cmdButtn(i )

.ToolTipText = .Caption

结束

下一页我是

正如我正在尝试的其他程序员一样不要使用升级

向导。有没有一种简单的方法可以在vb.net中翻译它

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.com 写道:

我从头开始重写一个VB6程序。在vb6中我有一个索引

commandbtton并且能够使用for循环来更改

整组按钮。例如下面的代码确定好了


Dim i As Integer

For i = 0 To cmdButtn.Count - 1

随着cmdButtn(i)

.ToolTipText = .Caption

结束

下一页我


至于其他每个程序员,我都试图不使用升级

向导。有没有一种简单的方法可以在vb.net中翻译这个
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



这是一个可能的anser:
http://msdn.microsoft.com/library/de ... visualcnet.asp


另一种只是将按钮固定在一个实际数组或Generic

列表中(如果你使用的话) 2005)然后你可以迭代列表:

按钮列表中的每个btn


btn.text =" hi"

next


HTH,

-

Tom Shelton

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 写道:

我从头开始重写一个VB6程序。在vb6中我有一个索引

commandbtton并且能够使用for循环来更改

整组按钮。例如下面的代码确定好了


Dim i As Integer

For i = 0 To cmdButtn.Count - 1

随着cmdButtn(i)

.ToolTipText = .Caption

结束

下一页我


至于其他每个程序员,我都试图不使用升级

向导。有没有一种简单的方法来翻译这个在vb.net
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



我不认为你会称之为简单,但你可以*手动*放

阵列中的按钮...


< aircode>

''在表格范围内

private mButtons()As Button = {_

cmdButton01,cmdButton02,cmdButton3,...,cmdButtonN _

}


''代码中的其他地方

每个B作为按钮在mButtons

B.ToolTipText = B.Caption

下一个

< / aircode>


HTH。


问候,


Branco。

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.


控制阵列已经消失。 (真可惜,我也用过它们。)


如果你想点击表格上的所有按钮,你可以点击

。这会将tooltiptext设置为等于按钮上的标题

。 【标题】属性已由[text]属性替换为



这是递归的,因此如果您的表单上有面板或

一些其他类型的容器,它也检查

中的控件也是那个容器。


Private Sub SetButtonText(ByVal ctrlContainer As Control)

每个ctrl作为控件在ctrlContainer.Controls

如果TypeOf ctrl是按钮那么

ctrl.ToolTipText = ctrl.Text

结束如果

''如果控件有子节点,则递归调用此函数

如果ctrl.HasChildren那么

SetButtonText(ctrl)

结束如果

下一页

结束次级

Robin S.

- -----------------

< Jo **** @ aol.comwrote in message

news:s1 * ******************************* @ 4ax.com ...
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...

>我正在从头开始重写VB6程序。在vb6中我有一个索引

commandbtton并且能够使用for循环来更改

整组按钮。例如下面的代码确定好了


Dim i As Integer

For i = 0 To cmdButtn.Count - 1

随着cmdButtn(i)

.ToolTipText = .Caption

结束

下一页我


至于其他每个程序员,我都试图不使用升级

向导。有没有一种简单的方法可以在vb.net中翻译这个
>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



这篇关于升级问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆