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 17 1584
In article <2F************ *************** *******@microso ft.com>, an*******@discu ssions.microsof t.com says... 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?
1) Create a form-level ArrayList.
2) After creating the button, add it to the ArrayList at the specified
index. Example:
myList.Insert(i , myNewButton)
3) In the click event handler, the "sender" object will be the button
that was pushed. Use the "IndexOf" method to find out which button was
pushed:
Dim index As Integer = myList.IndexOf( sender)
--
Patrick Steele
Microsoft .NET MVP http://weblogs.asp.net/psteele
* "=?Utf-8?B?V2lsbA==?=" <an*******@disc ussions.microso ft.com> scripsit: 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:
Creating Control Arrays in Visual Basic .NET and Visual C# .NET
<http://msdn.microsoft. com/library/?url=/library/en-us/dv_vstechart/html/vbtchCreatingCo ntrolArraysInVi sualBasicNETVis ualCNET.asp>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
In article <5F************ *************** *******@microso ft.com>, an*******@discu ssions.microsof t.com says... Great example one question, could you please give me an example (code) on how to create a form-level ArrayList ? thanx
Just define it outside of all of your methods:
Public Class MyForm
Inherits Form
Private myList As ArrayList = new ArrayList()
...
--
Patrick Steele
Microsoft .NET MVP http://weblogs.asp.net/psteele
Hi Will,
I do not understand this, this is almost the sample I gave you and the code
is VB.net code how did you do this in VB6?
Cor Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load Dim i As Integer = 0 Dim myPic(10) as pictureBox Dim yAxis As Integer = 9 For i = 0 To 1
MyPic(i) = New PictureBox
MyPic(i).Width = 130 MyPic(i).Height = 40
'Mypic(i).Font = New Font("Verdana", 9.75!, FontStyle.Regul ar)
MyPic(i).BackCo lor = Drawing.Color.B lack MyPic(i).SizeMo de = PictureBoxSizeM ode.StretchImag e MyPic(i).Locati on = New System.Drawing. Point(Left, Top) MyPic(i).Name = "Pic" & i 'Mypic(i).Text = rst("ProductNam e").Value MyPic(i).Locati on = New Point(660, yAxis) MyPic(i).Cursor = Cursors.Hand MyPic(i).BringT oFront() Me.Controls.Add (MyPic(i)) MyPic(i).Image = ImageList1.Imag es.Item(i)
AddHandler MyPic(i).Click, AddressOf mypic_click yAxis = yAxis + 5 + MyPic(i).Height Next End Sub
NEED THE CODE PLEASE
THANX IN ADVANCE
Hi Herfried,
This is a message about a VB.net sample I gave can this be done in VB6?
Cor
Hi Patrick,
This is a message about a VB.net sample I gave, can this be done in VB6?
In my sample is no need for an Arraylist I use that almost always, except
when the array is fixed as is in this sample.
Cor
Hi Patrick,
This is the correct answer by the way, accoording to my sample, although it
is an array Just define it outside of all of your methods:
But I did wanted to keep the sample nice and putted it inside the procedure.
Using directcast with the sender in the event, that I also supported (it is
disapeared now), it is not really needed, but when you do more with it, it
can be the answer.
And when the array really becomes dynamic using an arraylist is of course
better.
Cor
Cor,
* "Cor" <no*@non.com> scripsit: This is a message about a VB.net sample I gave can this be done in VB6?
What? Sorry, I don't understand what you want to tell me...
:-(
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Hi Herfried,
The poster tells that he has created this in VB6 while it is code I
supported to him on 26-1.
(You should have seen it before because I have contributed this so much,
because I find it a real nice example because it is so simple).
And now I am curious if this code can be done in VB6 because you are
answering that.
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.
Or am I crazy?
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
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...
|
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.
|
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 ,
|
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...
| |
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...
|
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 !
|
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...
|
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...
|
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.
|
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...
| |
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |