i have desiged a database project and on form i want to retrieve two fields from listbox, how
as:
i am manually assigning a colum of table eg:["username"] to listbox and.
when i select a item from listbox then i need empid of that selected item not the username.
code:

for (int a = 0; a < dt.Rows.Count-1; a++)
            {
                
                listBox1.Items.Clear();
                listBox1.Items.Add(dt.Rows[a]["username"]);
               listBox1.ValueMember = dt.Rows[a]["empid"].ToString();
             
            }

kindly help me to solve that problem.

It would help if you specified which programming language you are working in, so I could move this into the correct forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.