473,699 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Index


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(ByVa l sender As System.Object, ByVal e As System.EventArg s) 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.Regul ar

MyPic(i).BackCo lor = Drawing.Color.B lac
MyPic(i).SizeMo de = PictureBoxSizeM ode.StretchImag
MyPic(i).Locati on = New System.Drawing. Point(Left, Top
MyPic(i).Name = "Pic" &
'Mypic(i).Text = rst("ProductNam e").Valu
MyPic(i).Locati on = New Point(660, yAxis
MyPic(i).Cursor = Cursors.Han
MyPic(i).BringT oFront(
Me.Controls.Add (MyPic(i)
MyPic(i).Image = ImageList1.Imag es.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
Nov 20 '05
17 1594
Cor,

* "Cor" <no*@non.com> scripsit:
This is the start of the original thread
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:

I think that code cannot be done in VB6.


Yes, that can be done in VB6 by using a control array. You can
load/unload buttons to/from the array by using 'Load' and 'Unload' in
VB6.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #11
Cor
Herfried,

Look at the code he said he made this in VB6.
Yes, that can be done in VB6 by using a control array. You can
load/unload buttons to/from the array by using 'Load' and 'Unload' in
VB6.


Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.Controls.Add (MyPic(i))
MyPic(i).Image = ImageList1.Imag es.Item(i)
AddHandler MyPic(i).Click, AddressOf mypic_click
Next
End Sub

Are you sure of that, than VB6 could more than I thought?

Cor
Nov 20 '05 #12
Cor,

* "Cor" <no*@non.com> scripsit:
Look at the code he said he made this in VB6.
Yes, that can be done in VB6 by using a control array. You can
load/unload buttons to/from the array by using 'Load' and 'Unload' in
VB6.


Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.Controls.Add (MyPic(i))
MyPic(i).Image = ImageList1.Imag es.Item(i)
AddHandler MyPic(i).Click, AddressOf mypic_click
Next
End Sub

Are you sure of that, than VB6 could more than I thought?


Yes, something similar was possible with VB6. You could create a
control array and create a common handler for the array. The shared
handler had an index parameter which contained the index of the control
in the control array firing the event.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #13
Cor
The OP stated that he has written this code with VB6 that is my question.
I believe that something simular was posible exactly this code on VB6
(knowing me you know of course that I tried it already before I wrote this,
but did I see something wrong?)
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.Controls.Add (MyPic(i))
MyPic(i).Image = ImageList1.Imag es.Item(i)
AddHandler MyPic(i).Click, AddressOf mypic_click
Next
End Sub

Are you sure of that, than VB6 could more than I thought?


Yes, something similar was possible with VB6. You could create a
control array and create a common handler for the array. The shared
handler had an index parameter which contained the index of the control
in the control array firing the event.

Nov 20 '05 #14
* "Cor" <no*@non.com> scripsit:
The OP stated that he has written this code with VB6 that is my question.


Sorry, I misread. The code the OP posted won't run on VB6.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #15
Cor
No problem...

:-)

I could copy it,

:-))

Cor
Nov 20 '05 #16
Cor,

* "Cor" <no*@non.com> scripsit:
No problem...

:-)

I could copy it,


What?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #17
Cor
No proplem
What?


:-))
Nov 20 '05 #18

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

Similar topics

3
6080
by: Jofio | last post by:
Hello, I am a newbie in PHP and I am enthusiastically trying out things. I've just replaced my index.html ( file with index.php
9
2133
by: kosh | last post by:
I was wondering if there is or there could be some way to pass a generator an optional starting index so that if it supported that slicing could be made more efficient. Right now if you do use a generator and do a or any other kind of slice it reads all the values up to 100 also. I know a lot of generators have to do all previous parts before they can do the next part but it would be a nice optimization that can start at any index to...
2
10348
by: skura | last post by:
I am trying to understand how the data in sql server is stored and also regarding fill factor and page splitting. 1) My first question what is the difference between Index pages and Data pages. and how are they different for clustered and non clustered indexes and heap tables. 2) What is the relation between index and data pages.
6
4453
by: Anita | last post by:
I have just tested 3 queries using QA. The complete test information : ------ CREATE TABLE agls1 ( fyear char(4) NULL , fprefix char(3) NULL , fvcno char(20) NULL , fdate datetime NULL , fid char(15) NULL ,
8
4838
by: Andr? Queiroz | last post by:
Hi, I have a table with 10M records and col A has a index created on it. The data on that table has the same value for col A on all 10M records. After that I insert diferent values for that column but my queries do not use the index I created for that column. Is there any way I can force the usage of the index or to ommit a value on the index creation, like 0 (zeroes) or spaces? Thanks in advance, André Queiroz
14
5409
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why I get worse response time when the optimizer uses two indexes, than when it uses one. Some context:
4
10679
by: Steph. | last post by:
I have a List view displaying data in Detail mode with several columns. How I can get the column index the user clicked on ? (when user click on an item inside the ListView, not on a column hearder..) Thanks for any help !
2
5119
by: bobby_b_ | last post by:
I have a table where fields 1 and 2 make up the primary key. Because of this, I have a unique composite index on fields 1 and 2 (as required by DB2). Now my question is: Fields 1 and 2 are also separate foreign keys to two other tables. I have read that it is always a good idea to create indexes on foreign keys. Should I create single indexes on each of these fields? Or is that not necessary since they are already part of a composite...
85
4293
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the offending index are. Why does it force you to determine that information for yourself when it could save you a step and just tell you? This seems like a "no-brainer" to me. Am I missing something?
8
5574
by: shira | last post by:
I have done a fair bit of searching, but haven't yet been able to find an explanation as to why one would set "ignore nulls" to "yes" when creating an index. I understand what it does (I think), but I'm looking to understand what scenario might prompt either setting (yes or no). Any clarity you can provide is much appreciated! Thanks kindly.
0
8689
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8916
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8885
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.