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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:23:15+00:00 2026-05-13T22:23:15+00:00

From the code below I am getting a cell value from the selected row

  • 0

From the code below I am getting a cell value from the selected row to a dataGridView:

string Kategoria_ = dataGridView1.CurrentRow.Cells[1].Value.ToString();

Then I need to convert to int:

int category = Convert.ToInt32(Kategoria_);

And putting this number as an index to the combobox:

cmbCategory2.SelectedIndex = category;

Issue is that I’m using this kind of queries:

SELECT '0' b, ' All' a union select kategori_id b, kategori_emri a from tbl_kategoria order by a

and always I have +1 index, so I am not getting the true index (or to use -1 index number), because already 0 is reserved for ‘All’ value ?!

So, the selected item from the combobox has no right index number !!!

  • 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-13T22:23:16+00:00Added an answer on May 13, 2026 at 10:23 pm

    Just use SelectedValue instead of SelectedIndex. That will allow for gaps in the Id-range ad other sortings as well.

    Configure the ComboBox by setting ValueMember and DisplayMember (or DataValueSomething in ASP.NET) properties.

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

Sidebar

Ask A Question

Stats

  • Questions 489k
  • Answers 489k
  • 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 Take a look at Unity 3D: http://unity3d.com/ May 16, 2026 at 8:57 am
  • Editorial Team
    Editorial Team added an answer Probably because you didn't set the owner: this.Owner = App.MainWindow;… May 16, 2026 at 8:57 am
  • Editorial Team
    Editorial Team added an answer This can be accomplished by implementing the OnItemDataBound method (configured… May 16, 2026 at 8:57 am

Trending Tags

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

Top Members

Related Questions

How can I correct the problem I keep getting from the code below which
I'm having an issue with looping through a table in Javascript and getting the
new to Ruby so I'm still getting to grips with some of the Rails
Four years ago I wrote a Sudoku puzzle solver, and now I'm trying to
I have a variable with hyper links (www.wow.com) like this. I have to pass
I tried looking up other issues but couldn't find anything to match so here
I have an application written in VB.NET that interacts with Excel via interop. I
I have to read xls file in java.I used poi-3.6 to read xls file
I'm using Visual Studio 2008 with the October 2009 F# CTP installed. I'm trying

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.