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
Prasant Jinaga
1k
751
425.7k
Dynamically create ComboBox on click of button in vb (wpf)
Dec 13 2010 7:06 AM
How to Create ComboBox dynamically and add event handler for SelectionChanged event to that dynamically created ComboBox.
I tried this code
Private Sub CreateWPFComboBox()
Dim cbox As New ComboBox()
cbox.Width = 120
cbox.Height = 25
Dim cboxitem1 As New ComboBoxItem()
Dim textitem1 As New TextBox()
cboxitem1.Content = "C# Corner"
cbox.Items.Add(cboxitem1)
Dim cboxitem2 As New ComboBoxItem()
Dim textitem2 As New TextBox()
cboxitem2.Content = "VB.NET Heaven"
cbox.Items.Add(cboxitem2)
textitem2.Text = cboxitem2.ToString()
Dim cboxitem3 As New ComboBoxItem()
Dim textitem3 As New TextBox()
cboxitem3.Content = "MSDN"
cbox.Items.Add(cboxitem3)
textitem3.Text = cboxitem3.ToString()
cbox.SelectionChanged += New AddressOf CreateWPFComboBox
parent.Children.Add(cbox)
End Sub
But Event handler not working it's give me error
so anyone help me how to add event handler to this dynameically created combobx on selection changed of list items
Reply
Answers (
1
)
Different types of template selector
TextBox RaiseEvent KeyDownEvent does not work