指数 [英] Index

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

问题描述



大家好,我在运行时创建了5个按钮,在vb 6.0中,每个按钮都有一个独特的索引,如何在vb.net中完成?下面是代码


Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Loa

Dim i As Integer =

将myPic(10)调暗为图片

Dim yAxis As Integer =

for i = 0 To


MyPic(i)= New PictureBo

MyPic(i).Width = 13

MyPic(i).Height = 4

''Mypic(i).Font = New Font(" Verdana",9.75!,FontStyle.Regular


MyPic(i).BackColor = Drawing.Color.Blac

MyPic(i).SizeMode = PictureBoxSizeMode.StretchImag

MyPic(i).Location = New System.Drawing.Point(Left,Top

MyPic(i).Name =" Pic"&

''Mypic(i).Text = rst(" ProductName")。Valu

MyPic(i).Location = New Point(660,yAxis

MyPic(i).Cursor = Cursors.Han

MyPic(i).BringToFront(

Me.Controls.Add(MyPic(i)

MyPic(i).Image = ImageList1.Images.Item(i


AddHandler MyPic(i).Click,AddressOf mypic_clic

yAxis = yAxis + 5 + MyPic(i).Heigh

Nex

结束Su


需要代码PLEAS


THANX提前


Hey guys, i have 5 buttons created on runtime, in vb 6.0, each button had a unique index, how is done in vb.net? bellow is the code

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
Dim i As Integer =
Dim myPic(10) as pictureBo
Dim yAxis As Integer =
For i = 0 To

MyPic(i) = New PictureBo

MyPic(i).Width = 13
MyPic(i).Height = 4

''Mypic(i).Font = New Font("Verdana", 9.75!, FontStyle.Regular

MyPic(i).BackColor = Drawing.Color.Blac
MyPic(i).SizeMode = PictureBoxSizeMode.StretchImag
MyPic(i).Location = New System.Drawing.Point(Left, Top
MyPic(i).Name = "Pic" &
''Mypic(i).Text = rst("ProductName").Valu
MyPic(i).Location = New Point(660, yAxis
MyPic(i).Cursor = Cursors.Han
MyPic(i).BringToFront(
Me.Controls.Add(MyPic(i)
MyPic(i).Image = ImageList1.Images.Item(i

AddHandler MyPic(i).Click, AddressOf mypic_clic
yAxis = yAxis + 5 + MyPic(i).Heigh
Nex
End Su

NEED THE CODE PLEAS

THANX IN ADVANCE

推荐答案

在文章< 2F ********************************** @ microsoft.co m>,
an*******@discussions.microsoft.com 说。 ..
In article <2F**********************************@microsoft.co m>,
an*******@discussions.microsoft.com says...

嘿伙计们,我在运行时创建了5个按钮,在vb 6.0中,每个按钮

Hey guys, i have 5 buttons created on runtime, in vb 6.0, each button



有一个唯一索引,怎么样在vb.net中完成?


1)创建一个表单级ArrayList。

2)创建按钮后,将其添加到指定的ArrayList中

指数。示例:


myList.Insert(i,myNewButton)


3)在点击事件处理程序中,发件人按钮对象将是按下的按钮

。使用IndexOf和IndexOf。找出哪个按钮的方法

推送:


Dim index As Integer = myList.IndexOf(发送者)


-

Patrick Steele

Microsoft .NET MVP
http://weblogs.asp.net/psteele


*" =?Utf-8?B?V2lsbA ?== = QUOT; <一个******* @ discussions.microsoft.com> scripsit:
* "=?Utf-8?B?V2lsbA==?=" <an*******@discussions.microsoft.com> scripsit:
嘿伙计们,我在运行时创建了5个按钮,在vb 6.0中,每个按钮都有一个独特的索引,如何在vb.net中完成?下面是代码:
Hey guys, i have 5 buttons created on runtime, in vb 6.0, each button
had a unique index, how is done in vb.net? bellow is the code:




在Visual Basic .NET和Visual C#.NET中创建控件数据

< http:// msdn。 microsoft.com/library/?url=/library/en-us/dv_vstechart/html/vbtchCreatingControlArraysInVisualBasicNETVisualCN ET.asp>


-

Herfried K.瓦格纳[MVP]

< http://www.mvps.org/dotnet>



Creating Control Arrays in Visual Basic .NET and Visual C# .NET
<http://msdn.microsoft.com/library/?url=/library/en-us/dv_vstechart/html/vbtchCreatingControlArraysInVisualBasicNETVisualCN ET.asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


文章< 5F **** ******************************@microsoft.co m> ;,
一个******* @ discussion.microsoft.com 说...
In article <5F**********************************@microsoft.co m>,
an*******@discussions.microsoft.com says...
很好的例子一个问题,可以你能给我一个关于如何创建表单级ArrayList的示例(代码)吗?
thanx
Great example one question, could you please give me an example (code) on how to create a form-level ArrayList ?
thanx




只需在所有方法之外定义它:


公共类MyForm

继承表格


私有myList As ArrayList = new ArrayList()


...

-

Patrick Steele

Microsoft .NET MVP
http:// weblogs .asp.net / psteele


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

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