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

  • Home
  • SEARCH
  • 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 8986285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:30:49+00:00 2026-06-15T21:30:49+00:00

This is probably classic noob question but Im really new to C# (Windows Forms

  • 0

This is probably classic noob question but Im really new to C# (Windows Forms App), and I would appreciate any help on this. So, Im looking for the way to do this:
I have one list box with items that represent database table entries. I want to delete a row in database table by deleting list box item. Is there any way to assign value to list box item (primary key for example) so I could use it to update db table when deleting list box item?

Thanks for your time!

EDIT: Its Db4o database.

  • 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-15T21:30:50+00:00Added an answer on June 15, 2026 at 9:30 pm

    If you want to do it manually:

    public class MyDBRecord
    {
        public int ID { get; set; } 
        public string Text { get; set; }
        public MyDBRecord(int _id, string _text)
        {
            ID = _id;
            Text = _text;
        }
    }
    private void button1_Click(object sender, EventArgs e)
    {
        listBox1.DisplayMember = "Text";
        listBox1.ValueMember = "ID";
    
        listBox1.Items.Add(new MyDBRecord(1, "abc"));
        listBox1.Items.Add(new MyDBRecord(2, "def"));
        listBox1.Items.Add(new MyDBRecord(3, "hij"));
    }
    
    private void button2_Click(object sender, EventArgs e)
    {
        MyDBRecord Selected;
    
        Selected = listBox1.SelectedItem as MyDBRecord;
    
        if (Selected != null)
            MessageBox.Show(Selected.ID.ToString());     
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably really simple but I have hardly any experience with classic ASP
This probably is a dummy question but I cannot find a clear indication. I
I know this probably really simple but Im not sure what im doing wrong...
Im sorry for this probably dumm question, but I want to simply open modals
This isn't a classic programming language question, but it's keeping me busy so I
This probably another silly question - but is there an MKMapViewDelegate method that can
This probably might be a silly question, but what I am trying to do
This probably seems like a very simple question, and I would probably know if
This probably sounds like a terrible idea at first glance, but here is my
I know this probably has been asked before but I am having issues with

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.