473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Usercontrol and combobox

Hi,

Can someone tell me how I start an event automatically when I change an item
in a combobox, which is in a usercontroller.

I tried the following but it doesn't work;

ComboBox UserController;

Public Class ucComboBox
Public Event Start()

#Region " Windows Form Designer generated code " ..........

Protected Overridable Sub ComboBox_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox.SelectedIndexChanged

RaiseEvent Start()

End Sub

End Class

Main form;
Public Class form1

Friend WithEvents MySender As ucComboBox

#Region " Windows Form Designer generated code " ..........

Private Sub MySender_Start() Handles MySender.Start

MsgBox("Do something!")

End Sub

End Class


Nov 21 '05 #1
4 2149
wrambel wrote:
Hi,

Can someone tell me how I start an event automatically when I change an item
in a combobox, which is in a usercontroller.

I tried the following but it doesn't work;

ComboBox UserController;

Public Class ucComboBox
Public Event Start()

#Region " Windows Form Designer generated code " ..........

Protected Overridable Sub ComboBox_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox.SelectedIndexChanged

RaiseEvent Start()

End Sub

End Class

Main form;
Public Class form1

Friend WithEvents MySender As ucComboBox

#Region " Windows Form Designer generated code " ..........

Private Sub MySender_Start() Handles MySender.Start

MsgBox("Do something!")

End Sub

End Class



Not too fimiliar with user controls but calling

MyBase.OnSelectionChangeCommitted(EventArgs.Empty)

in my inherited combobox forces the event to fire for anyone handling
the event.

Chris
Nov 21 '05 #2
wrambel,

Why do you want to raise an event when you just can call the sub that
handles that event?

Myevent(nothing,nothing)
Myevent(me,nothing)
Myevent(TheControl,nothing)
and a lot more

I hope this helps,

Cor
Nov 21 '05 #3
Hi,

Thanks for replaying,

where in my code should I insert your solution?

Greetz,

William

"Chris" <no@spam.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
wrambel wrote:
Hi,

Can someone tell me how I start an event automatically when I change an
item in a combobox, which is in a usercontroller.

I tried the following but it doesn't work;

ComboBox UserController;

Public Class ucComboBox
Public Event Start()

#Region " Windows Form Designer generated code " ..........

Protected Overridable Sub ComboBox_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox.SelectedIndexChanged

RaiseEvent Start()

End Sub

End Class

Main form;
Public Class form1

Friend WithEvents MySender As ucComboBox

#Region " Windows Form Designer generated code " ..........

Private Sub MySender_Start() Handles MySender.Start

MsgBox("Do something!")

End Sub

End Class



Not too fimiliar with user controls but calling

MyBase.OnSelectionChangeCommitted(EventArgs.Empty)

in my inherited combobox forces the event to fire for anyone handling the
event.

Chris

Nov 21 '05 #4
Hi,

Thanks for replaying,

where in my code should I insert your solution?

Greetz,

William
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:ej**************@TK2MSFTNGP15.phx.gbl...
wrambel,

Why do you want to raise an event when you just can call the sub that
handles that event?

Myevent(nothing,nothing)
Myevent(me,nothing)
Myevent(TheControl,nothing)
and a lot more

I hope this helps,

Cor

Nov 21 '05 #5

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

Similar topics

5
by: codymanix | last post by:
My problem is: I have comboboxes which resides in a usercontrol. Always when the usercontrol changes its visible status (the dialog is shown or you switch to the tabpage where the usercontrol...
1
by: bob scola | last post by:
I have a csharp, VS 2003 solution for a winform application The application uses an object called a "matter" and the class is defined in matter.cs. I can load matter objects into a combobox ...
2
by: John B | last post by:
Hello I want to create a set of controls that have some common methods and properties. I was thinking that I should subclass the UserControl class and add these common features there and then...
13
by: Michael Maes | last post by:
Hi, I have a UserControl containing some controls of which one is a ComboBox. All the InternalControls are Private and some are allowed to be accessed through Public Methods. One of the things I...
8
by: ChrisK | last post by:
Hi, I'm beginner with VB.net and i have a trouble... At work, they decided to program with tabcontrol...and i'mm in charge of this ! There is my problem. I've a form with one tabcontrol (TBC1...
1
by: Jochen Berger | last post by:
Moin! I've 'composed' a special UserControl I need for my current project. On this Control I put a ComboBox. The user is not allowed to access the ComboBox directly (to protect some properties),...
9
by: davidr | last post by:
Hi, I've researched this a lot and have a well understanding but still can't get the darn textbox in the javascript. I have a textbox that is set to runat="server" and I have a client...
5
by: Blue | last post by:
We have a custom word processing type editor built with C# and .NET 2.0 and we need to support typing in languages other than English. I want to be able to use the Windows IME to enter in text...
3
by: Martin | last post by:
Hi ! I've developed a small UserControl with five textbox and label. However, when I want to display the UserControl in a form, controls appear slowly one after one. I've activated double...
4
by: Martin | last post by:
Hi everyone ! For those who haven't read my previous post, I have a problem with a UserControl. When I try to display it on a form, controls seem to appear one after one. In the following...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.