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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:53:37+00:00 2026-05-26T03:53:37+00:00

I want to get some data to fill a listview control, but this data

  • 0

I want to get some data to fill a listview control, but this data it’s determined in other form. This is what I code in form1 (Nuevo_Credito):

private void combo_cliente_SelectionChangeCommitted(object sender, EventArgs e)
    {
        Credito_Grupo ventana = new Credito_Grupo(combo_cliente.SelectedItem);
        ventana.ShowDialog(); 
    }
 public void AgregaIntegrantes(string id, string nombre, string monto)
        {
            ListViewItem elem = new ListViewItem(id);
            elem.SubItems.Add(nombre);
            elem.SubItems.Add(monto);
            listView_integrantes.Items.Add(elem);
        }

I’m invoking form2 (Credito_grupo) as show dialog window, then I want to retrieve some values and pass them to Form1 using the public method “AgregaIntegrantes”. So in form2 I did the following:

public Credito_Grupo(dynamic item)
    {
        this.id = item.IDCliente;
        this.nombre = item.NomComp;

        InitializeComponent();
    }

    private void Credito_Grupo_Load(object sender, EventArgs e)
    {
        text_nombre.Text = this.nombre;
    }

    private void button_AgregaCliente_Click(object sender, EventArgs e)
    {
        Nuevo_Credito obj = new Nuevo_Credito();
        obj.AgregaIntegrantes(id.ToString(), nombre, text_monto.Text);

        this.Close();
    }

When the event button_AgregaCliente_click is triggered I need to add the data to listview in form1 using the method described above, but none data is added. I found a solution using delegates here 3077677, is there an approach using objects?

  • 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-26T03:53:38+00:00Added an answer on May 26, 2026 at 3:53 am

    You have an error in button_AgregaCliente_Click method (the last one in the listing). You create a new Nuevo_Credito form there, and pass the data to listview. It looks OK. But this newly created Nuevo_Credito form does exist only in the local variable, so then you throw it away without displaying it when button_AgregaCliente_Click finishes.

    I think you need to delete this line: Nuevo_Credito obj = new Nuevo_Credito();
    You need to get your real Nuevo_Credito form, not create a new one here.

    You can send this from your Nuevo_Credito to the constructor of the Credito_Grupo form. Then you can use it to call back to the original Nuevo_Credito. This approach is based only on objects, and not delegates. As you wanted. 🙂

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

Sidebar

Related Questions

I am using http://lite.facebook.com And i want to get some data from my account.
I have one problem , I want to get some data from XML file
So, the question is: I get some notifications I don't want to get. But
I want to get myself into programming some serious GUI based applications, but when
I have this modalPopupExtender, I want it to show a CheckBoxList with some data.
I want to pass some data around threads but want to refrain from using
I want to get started doing some game development using Microsoft's XNA. Part of
To get some smooth graphics, I want to draw oversampled by factor 2 and
I want to get into Erlang programming, specifically some yaws stuff. (Currently, I use
Say I want to get the HTML of http://www.google.com as a String using some

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.