|
-
May 8th, 2003, 09:19 AM
#1
Thread Starter
Member
userdefined control
hi!
has anybody experience in programming userdefined controls?
i need a control which looks like that

if the user clicks on the button inside the textbox an event should be raised.
thanks for your help
Robert
-
May 8th, 2003, 10:11 AM
#2
In your VB project click Add New Item (from the File menu) and select User Control.
Add the controls you want (e.g. the text box and the button) to this new user control and write the code behind the button:
You'll have to declare the event in the user control as follows:
Close and save the user control and then build your solution.
Look in the toolbox and you should find your new user control. Drop it on a form and you should be able to find the following event in the form.
VB Code:
Private Sub UserControl11_blah() Handles UserControl11.blah
End Sub
This world is not my home. I'm just passing through.
-
May 8th, 2003, 11:02 AM
#3
Thread Starter
Member
ok... that work's but it doesn't look like what i expected
Maybe there is a way to use a combobox instead of a textbox + button and the click-event which opens the dropdown-list could be used.
I experimented with this idea but it doesn't work because the OnDrawItem is fired more than one time if i click on the dropdown-button.
Code:
Imports System.ComponentModel
Imports System.Drawing
Public Class MultiComboBox
Inherits ComboBox
Protected Overrides Sub OnDrawItem(ByVal ea As DrawItemEventArgs)
' do what i want to do
end sub
I'm sure that also the small arrow can be changed to (...) but i've no idea how to do this.
-
May 9th, 2003, 02:03 AM
#4
Maybe you could try using a flat style textbox with a standard button and putting them both on top of a 3D style Panel control.
I too have had problems making my user controls look as good as the supplied ones.
I have come to the conclusion that it is best to redesign your UI to work with standard controls - that is what your users will be used to in any case.
This world is not my home. I'm just passing through.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|