Visual Basic .NET Forums    

Go Back   Visual Basic .NET Forums > VB.NET > Component Development

VB.NET Forums Newsletter Signup:
Email address:


Component Development Development of components with VB.NET

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-23-2008, 1:57 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Oct 2008
Age: 69
Posts: 4
Reputation: 0
dluxoh is on a distinguished programming path ahead
Default custom controls not working with toolbox.

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
However, if I try to drag my component onto the form from the toolbox using the designer, I get errors once I save the project or try to build it.

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.
Reply With Quote
  #2 (permalink)  
Old 10-23-2008, 2:40 PM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 24
Posts: 2,996
Reputation: 212
JuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET star
Default

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/
Reply With Quote
  #3 (permalink)  
Old 10-23-2008, 2:44 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Oct 2008
Age: 69
Posts: 4
Reputation: 0
dluxoh is on a distinguished programming path ahead
Default

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
Of course warnings are never good to have either... once again, any useful information would be appreciated.
Quote:
Originally Posted by JuggaloBrotha View Post
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.
I am following those exact same steps, only I get an error this makes no sense to me and is very frustrating.
Reply With Quote
  #4 (permalink)  
Old 10-23-2008, 4:31 PM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 24
Posts: 2,996
Reputation: 212
JuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET star
Default

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
Which I don't know what you're doing here, so I can't tell you what's wrong.
__________________
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/
Reply With Quote
  #5 (permalink)  
Old 10-24-2008, 3:44 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Oct 2008
Age: 69
Posts: 4
Reputation: 0
dluxoh is on a distinguished programming path ahead
Default

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.
Reply With Quote
  #6 (permalink)  
Old 10-24-2008, 10:49 AM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 24
Posts: 2,996
Reputation: 212
JuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET star
Default

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/
Reply With Quote
  #7 (permalink)  
Old 10-24-2008, 1:06 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Oct 2008
Age: 69
Posts: 4
Reputation: 0
dluxoh is on a distinguished programming path ahead
Default

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
Next I build the project.
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
Reply With Quote
  #8 (permalink)  
Old 10-24-2008, 1:29 PM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 24
Posts: 2,996
Reputation: 212
JuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET starJuggaloBrotha a shining VB.NET star
Default

Quote:
Originally Posted by dluxoh View Post
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
Next I build the project.
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
You have an inconsistency going here. In your first post the only custom control code you posted was this line:
Code:
    Dim test As FormattedTextbox
Which doesn't show any of the actual control's code. It doesn't provide any information as to why you're getting an error at all.

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/
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 8:40 PM.




Click to advertise here

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
For advertising opportunities click here.