Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 28th, 2003, 05:51 AM
Authorized User
 
Join Date: Jun 2003
Location: Norfolk, , United Kingdom.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Controls

Hi

I'm creating a modified textbox as a user control, this part all works quite nicley now. When I add this control to the main project to use as you would any other control, and go to use it's methods, like usercontrol1.gotfocus or usercontrol1.textchanged nothing happens these methods are not being executed is this normall behaviour?

How do I enable these methods to work within the application, it wouldn't make sense to use the methods of the user control because the application could require links to a database or other objects that the user control wouldn't no about or have a reference to.



Duncan
__________________
Duncan
Reply With Quote
  #2 (permalink)  
Old November 28th, 2003, 06:51 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

When you have a control on a user control you need to expose it if you want to access its properties. You have a couple options:
1. Make the control public
2. Create a public property to serve as a accessor to the control
3. Create specific properties on the user control that access the specific properties of the form controls you need access to. (For example, the text value of a given text box. If you only need to access that, then create a public property for just that and not the whole textbox.)

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old December 1st, 2003, 05:41 AM
Authorized User
 
Join Date: Jun 2003
Location: Norfolk, , United Kingdom.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter

Thanks for the reply, but the issue I'm having is when using the user control in an application (EXE) not within the user control(DLL), I have found by using a component class an inheriting the control gives me all default properties without any coding, all I need to do is code for the properties I want to add saves reinventing the wheel.

My Problem:
When you add a user control to an application (EXE) and try to use the methods of the user control within the application. Let's say I put code into the gotfocus event, this event is not fired at all when the application runs. How do I get this event to fire?



Duncan
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User controls dcct84 C# 2 October 28th, 2007 07:20 PM
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
User Controls Lofa ASP.NET 1.0 and 1.1 Basics 2 February 13th, 2006 01:04 PM
User Controls..... Help please cowboy2066 General .NET 2 July 28th, 2004 09:22 AM
User Controls Duncan Pro VB.NET 2002/2003 1 October 27th, 2003 12:51 PM



All times are GMT -4. The time now is 08:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.