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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:52:18+00:00 2026-05-25T17:52:18+00:00

I am aware that there other questions like this, but their solutions do not

  • 0

I am aware that there other questions like this, but their solutions do not work for me.

I have the following code:

     lueSizes.Properties.DataSource = new BindingSource(PS.PaperSizes, null);
     lueSizes.Properties.Columns.Add(new LookUpColumnInfo("PaperName", "Größe"));
     lueSizes.Properties.DisplayMember = "PaperName";
     lueSizes.Properties.ValueMember = "PaperName";

     //PS is a regular System PrinterSettings object
     foreach (PaperSize size in PS.PaperSizes)

         //I confirmed with debugging that this actually happens correctly
         if (size.RawKind == binSettings.SizeRawKind)
          {
              lueSizes.EditValue = size;
              break;
          }

Populating the LookupEdit with the DataSource works fine, the user can select the desired PaperSize from the dropdown, and

lueSizes.GetSelectedDataRow() as PaperSize

then returns a PaperSize object as expected.

The problem I have is setting the EditValue, it simply does nothing. I have verified that at runtime, the DataSource contains all the PaperSize objects in PS.PaperSizes, including the one that is found in the foreach loop. But setting EditValue = size does not cause the selected data row to update accordingly.

Other variations I have tried are:

lueSizes.EditValue = size.PaperName;

lueSizes.EditValue = lueSizes.Properties.GetKeyValueByDisplayText(size.PaperName);

lueSizes.EditValue = lueSizes.Properties.GetKeyValueByDisplayValue(size.PaperName);

lueSizes.EditValue = lueSizes.Properties.GetKeyValueByDisplayValue(size);

lueSizes.EditValue = 0;

None of these do anything, the selected datarow remains NULL and displays nothing to the user.

What else can I try to set the selected DataRow by code?

Edit:

    private void lueSizes_EditValueChanged(object sender, EventArgs e)
    {
        object o = lueSizes.EditValue;
        object p = lueSizes.GetSelectedDataRow();
        PaperSize size = o as PaperSize;
        UpdateSize(size);
    }

Object o is the item I have set earlier, the PaperSize size that Ive found in the loop, but object p is null.

  • 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-05-25T17:52:19+00:00Added an answer on May 25, 2026 at 5:52 pm

    I think I have at least found a workaround:


    BindingSource bindingSource = new BindingSource(PS.PaperSizes, null);
    lueSizes.Properties.DataSource = bindingSource;
    lueSizes.Properties.Columns.Add(new LookUpColumnInfo("PaperName", "Größe"));
    lueSizes.Properties.DisplayMember = "PaperName";
    
    foreach (PaperSize size in bindingSource)
        if (size.RawKind == BinSettings.SizeRawKind)
        {
            lueSizes.EditValue = size;
            break;
        }
    

    private void lueSizes_EditValueChanged(object sender, EventArgs e)
    {
        PaperSize size = lueSizes.EditValue as PaperSize;
        Update(size);
    }
    

    So first, I let the loop search in the BindingSource, which I have to define explicitely now, instead of the Printersettings object.

    Next, I may not set the DisplayValue property.

    Finally, I avoid looking up the DataRow and go for the edit value directly. Don’t know what limitations

    I don’t know what else that breaks, if anything, but for now it works.

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

Sidebar

Related Questions

Ok so I know there's other questions like this. But mine is a little
I am aware that questions about recurring events are common but I have not
First off, I'm aware that there are many questions related to this, but none
I'm aware of other questions about modules and namespaces in F#, but they're not
I aware that this will be a less programming question, but still... How can
Im aware there are many questions on SO about notifications, but I havent come
I'm aware that there probably isn't a perfect solution to my question (this sounds
First, Let me start by saying thatI am aware of other similar questions, like
I am aware that there is a similar question here with no solution. I'm
Now, I am aware that there is no such thing as exiting an app

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.