TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jun Martin
NA
3
2.9k
Array of function pointer variable
Jun 19 2011 10:30 AM
Dear all,
I have a button that if I click, the btn_click will call a function that will create additional buttons (qty of button will depend of the length of array passed to that function) that will have a customizable text and handler...
I have managed to put the text by the following code:
[code]
Dim btn_text() As String = {"Func 1","Func 2", "Func 3"}
For x = 0 To btn_text.Length - 1
Dim btn As New Button
btn.Text = btn_text(x)
'here should be where I assign the handler
Me.Controls.Add(btn)
Next
[/code]
But, when I need to assign the handler, I'm using another string array that contains the function's name.
And then during the "AddHandler btn.Click, AddressOf ", the AddressOf can't take string as parameter.
So my question is:
-am I doing it in a correct and effective way? at least for the text button?
-if yes, how do we assign the functions to the button handler via an array/variable?
-if no, what is the common method that people do for these kind of task?
Many Thanks,
JM
Reply
Answers (
2
)
TextBox Validation
[.NET C#] Getting a BaseCollection countaining everyfiles on the computer