![]() |
|
|||||||
| Component Development Development of components with VB.NET |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello I'm using VB.Net Express 2008 to write a program and want to make a custom control that inherits the TextBox class. I've done so successfully to a degree, but whats happening now is very frustrating.
I can successfully instanciate my new textbox using the following code in my main form: Code:
Public Class SignBuilderForm
Dim test As FormattedTextbox
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
test = New FormattedTextbox
test.Enabled = True
test.Visible = True
test.Parent = GroupBox1
test.Width = 50
' Add any initialization after the InitializeComponent() call.
End Sub
End Class
Code:
Error 1 Type 'SignBuilderForm.FormattedTextbox' is not defined. C:\Documents and Settings\Administrator\Desktop\Gregs Projects\VBApps\SignBuilderForm\SignBuilderForm\SignBuilderForm.Designer.vb 32 36 SignBuilderForm Error 2 Type 'SignBuilderForm.FormattedTextbox' is not defined. C:\Documents and Settings\Administrator\Desktop\Gregs Projects\VBApps\SignBuilderForm\SignBuilderForm\SignBuilderForm.Designer.vb 134 44 SignBuilderForm Am I mistaken or is visual studio express supposed to allow you to use the designer to place your user created controls onto your project? What am I doing incorrectly here? Thanks P.S. I appologize for the repost, I feel that my problem is much better worded on this post. I tried to delete my previous thread but it looks like thats not an option ont his forum. |
|
||||
|
What I do is I make the control, then I compile the project (run it) and after that it shows up in the toolbox, drop it on the form and there ya go.
__________________
There are 3 kinds of people in the world: Those who can count and those who can't.
Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition. For an extensive list of MS Service packs and extensions: http://www.juggalobrotha.com/ |
|
|||
|
I've added System.Windows.Forms to my resources. I don't get an error now, but I do get a warning:
Code:
Warning 1 Namespace or type specified in the project-level Imports 'FormattedTextBox' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. SignFormBuilder Quote:
this makes no sense to me and is very frustrating.
|
|
||||
|
Well you're not using the same steps, you've added this level of complexity:
Code:
Public Class SignBuilderForm
Dim test As FormattedTextbox
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
test = New FormattedTextbox
test.Enabled = True
test.Visible = True
test.Parent = GroupBox1
test.Width = 50
' Add any initialization after the InitializeComponent() call.
End Sub
End Class
__________________
There are 3 kinds of people in the world: Those who can count and those who can't.
Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition. For an extensive list of MS Service packs and extensions: http://www.juggalobrotha.com/ |
|
|||
|
Well the point that I was trying to get across is that if I create a custom control, and drag it from the toolbox onto my form, I get errors and all sorts of mess.
However, if I manually create an instance of my custom control (the code shown), I don't get any errors at all.... I do not have any intention of using that code, it was an example of what is working vs what isn't working. Should I reinstall my IDE? It has to be something I'm doing incorrectly. |
|
||||
|
I've had similar problems with this before, post your custom control code here, I'm willing to bet it has something to do with a property you're overriding.
Also if you posted the error message, that'll help narrow down the problem too.
__________________
There are 3 kinds of people in the world: Those who can count and those who can't.
Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition. For an extensive list of MS Service packs and extensions: http://www.juggalobrotha.com/ |
|
|||
|
All that information is in my first post... I'll start over. New project, and a fresh class that inherits textbox.
here's my class: Code:
Public Class MySpecialTextBox : Inherits TextBox End Class So far so good. Now I drag my new component from the toolbox to the form. I see a textbox on the form... now I build. . . and it works... strange... I don't know what I did differently this time asside from choosing a different name for my component... oh well I guess I'll never know :P |
|
||||
|
Quote:
Code:
Dim test As FormattedTextbox Now in the most recent of your posts you have a custom control named 'FormattedTextbox' which isn't 'MySpecialTextBox'. What's actually going on?
__________________
There are 3 kinds of people in the world: Those who can count and those who can't.
Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition. For an extensive list of MS Service packs and extensions: http://www.juggalobrotha.com/ |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|