Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:58:39+00:00 2026-06-17T21:58:39+00:00

I am trying to bind structure members to Label s in Windows Forms .

  • 0

I am trying to bind structure members to Labels in Windows Forms. However, I’m unable to do this because this structure is a member of a class, and I need to bind a couple of members to Labels.

Let’s say that this structure is a System.Drawing.Point, and I want to bind X and Y property to a Label.

Imports System.ComponentModel
Public Class Form1
    Implements INotifyPropertyChanged

    Private _pt As Point
    Public Property Pt As Point
        Get
            Return _pt
        End Get
        Set(value As Point)
            _pt = value
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Pt"))
        End Set
    End Property


    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Label1.DataBindings.Add("Text", Me, "Pt")
        Label2.DataBindings.Add("Text", Me.Pt, "X")
        Label3.DataBindings.Add("Text", Me, "Pt.Y")
    End Sub

    Public Event PropertyChanged(sender As Object, e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

End Class

If I set the bindingsource to Me and datamember to structure then Label1 will show the result of ToString() method, Label2 value of X property and Label3 will not change.

But if I assign a new Point to Pt property, then only Label1 will update its value. Label2 will not because datasource is no longer the same. Also, Label3.DataBindings.Add("Text", Me, "Pt.Y") does not work, because it’s not possible that datamember is “submember”.

I have also tried to make a new Structure that implements INotifyPropertyChanged in all its properties, but no luck.

Is there a way to make binding for Label2 or Label3 possible, even if I assign new Structure to it?

My goal is to assign new Point to Me.Pt property and observe values of Pt.X and Pt.Y on Label2 and Label3 via databinding.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:58:40+00:00Added an answer on June 17, 2026 at 9:58 pm

    You almost got it right. Label1 and Label3 will work AS IS. Change

    Label2.DataBindings.Add("Text", Me.Pt, "X")
    

    to

    Label2.DataBindings.Add("Text", Me, "Pt.X")
    

    And Label2 will also start working.

    Just make sure you assign a new value through a property, and not through your _pt field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a menu with this structure: <ul id=primary class=menuOptions> <li>Item
I am trying to bind a structure with Rowset binding ala: http://msdn.microsoft.com/en-us/library/aa215456(v=sql.80).aspx THIS IS
I am trying to bind a listview item to a member of a structure,
I'm trying to bind the visibility flags of a pair of grids, however they
I'm trying to bind a simple tree structure to an ItemsControl's itemsSource in a
I'm trying to bind a List<List<string>> to a DataGrid programatically. I'm using this List<List<string>>
I'm trying to bind a table of structures to a DataGridView. Loading and viewing
Im trying to bind a list with datetime objects to my repeater. if (e.Item.ItemType
I'm trying to bind a list of data to a data grid, but can't
I am trying to bind a model coming from the server over json to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.