Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 10th, 2005, 10:48 PM
Authorized User
Join Date: Nov 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default binding a constituent control to property

Sorry to trouble y'all again, but the MSDN site (http://msdn.microsoft.com/library/de...lecontrols.asp) says when binding a constituent control to a property of a custom actives control, use the following:

Property Get AddressLine1() As String
   AddressLine1 = txtAddressLine1.Text
End Property

Public Property Let AddressLine1(NewValue As String)
   If CanPropertyChange("AddressLine1")
      txtAddressLine1.Text = NewValue
      ' The following line tells Visual Basic the
      ' property has changed--if you omit this line,
      ' the data source will not be updated!
      PropertyChanged "AddressLine1"
   End If
End Property
 So for my project, I did it:

Public Property Get dim1() As Single
    dim1 = txtdim1.text
End Property

Public Property Let dim1(ByVal New_Dim1 As Single)
    If CanPropertyChange("Dim1") Then
        txtdim1.Text = New_Dim1
        PropertyChanged "Dim1"
    End If
End Property
The problem is that I get a Type Mismatch error in my Property Get procedure: dim1=txtdim1.text line when I try to click on the txtdim1 textbox in design mode. I even get the same error if I use dim1=CSng(txtdim1.text). Any reason why this should be?
Reply With Quote
  #2 (permalink)  
Old November 11th, 2005, 02:08 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

the line


gets a type mismatch every time the string in the text box cannot be converted to a number (for eaxmple, when it is empty...)

Add error handling.
Reply With Quote

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
Binding SQLDataSource To A Label Control sg225551 ASP.NET 2.0 Basics 1 January 16th, 2008 10:36 AM
binding url to an image control sarah lee ASP.NET 2.0 Professional 4 August 31st, 2006 02:14 PM
Button enable property - Late binding aruchamy .NET Framework 2.0 2 June 18th, 2006 09:44 AM
Adding Constituent Controls AGS BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 1 December 12th, 2005 06:32 AM
binding an tinyint to a CheckBox control... ShadowMoon ADO.NET 0 October 26th, 2004 05:55 AM

All times are GMT -4. The time now is 10:03 AM.

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