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 108523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:55:31+00:00 2026-05-11T01:55:31+00:00

Problem 1: I have a simple winforms app and I want to DataBind my

  • 0

Problem 1:

I have a simple winforms app and I want to DataBind my Person.Name property to a textbox. Name is of type StringField. I originally defined the Name property as String. The data binding works great on value types such as String. I would like the StringField.Value property to be the default property of StringField. I want to see the value of StringField.Value in the textBox rather than the text ‘FieldApp.StringField’.

Problem 2:

I would like to be able to assign a string to a StringField using operator =. This assignment would result in the StringField.Value member being set.

Can this be accomplished?

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;  namespace FieldApp {     public class StringField     {         public string Value { get; set; }         }      public class Person     {          //private String _Name;         //public String Name         //{         //    get { return _Name; }         //    set { _Name = value; }         //}          //public Person(string name)         //{         //    Name = name;         //}          private StringField _Name;         public StringField Name         {             get { return _Name; }             set { _Name = value; }         }          public Person(string name)         {             Name = new StringField();             Name.Value = name;         }     }      public partial class FieldAppForm : Form     {         Person person = new Person('steve');          public FieldAppForm()         {             InitializeComponent();         }          private void button1_Click(object sender, EventArgs e)         {             //our form contains a button1 and textBox1              //this compiles             person.Name.Value = 'steve';              //this does not. Is there anyway to accomplish this?             person.Name = 'steve';              //steve appears in the textbox              textBox1.DataBindings.Add('Text', person, 'Name.Value');              //FieldApp.StringField appears in the textbox              textBox1.DataBindings.Add('Text', person, 'Name');         }     } } 
  • 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. 2026-05-11T01:55:31+00:00Added an answer on May 11, 2026 at 1:55 am

    You could create an implicit operator overload. Then you can create StringField from strings like this:

    StringField field = 'value of new object'; string value=(string)field; 

    Know that this creates a new StringField object. I wouldn’t necessarily advice you to do this.

    [System.Diagnostics.DebuggerDisplay('{Value}')] public class StringField {     public string Value { get; set; }     public static implicit operator StringField(string s)     {         return new StringField { Value = s };     }      public static explicit operator string(StringField f)     {         return f.Value;     }     public override string ToString()     {         return Value;     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 163k
  • Answers 163k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I haven't tried your particular example, but the normal way… May 12, 2026 at 12:10 pm
  • Editorial Team
    Editorial Team added an answer yes, you need to use the webHttpBinding on your WCF… May 12, 2026 at 12:10 pm
  • Editorial Team
    Editorial Team added an answer You could try JQuery's trigger function. $('#thisLink').trigger('click'); This should possibly… May 12, 2026 at 12:10 pm

Related Questions

I have what seems to be a simple problem that I can't solve myself.
I've got a WinForm where the user has the ability to drag an item
I have to enable all the text in a winforms application to be replaced;
I realize that the answer to this question is likely quite obvious (if somewhat

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.