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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:54:42+00:00 2026-06-13T05:54:42+00:00

I have this combobox BindingSource srd = new BindingSource(); srd.DataSource = llenar.Tables[cnae]; CmbCnaePrin.DataSource =

  • 0

I have this combobox

BindingSource srd = new BindingSource();
srd.DataSource = llenar.Tables["cnae"];
CmbCnaePrin.DataSource = srd;
CmbCnaePrin.DisplayMember = "cnae_descricao";
CmbCnaePrin.ValueMember = "cnae_id";

i want to load this

int cnaepr;
DataTable dt3 = new DataTable();
dt3 = ifd.cnaeclas(cnaepr);
txtCnaeC.Text = dt3.Rows[0][2].ToString();
txtCnaeSC.Text = dt3.Rows[0][3].ToString();

but i can not convert

 cnaepr=Convert.ToInt32(CmbCnaePrin.SelectedValue)

returns this error Unable to cast object of type ‘System.Data.DataRowView’ to type ‘System.IConvertible’.

  • 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-13T05:54:42+00:00Added an answer on June 13, 2026 at 5:54 am

    Try calling ToString() on the SelectedValue property:

    cnaepr=Convert.ToInt32(CmbCnaePrin.SelectedValue.ToString());
    

    The error is pretty much exactly what it says; the SelectedValue property is designed to be very generic so it can be anything you could find in a DataTable. Most of those things that it could be are not “convertible” types (implementing IConvertible).

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

Sidebar

Related Questions

I have this: cmbConnections.DisplayMember = Name; cmbConnections.ValueMember = Index; cmbConnections.DataSource = DBConnectionSettings.ConnectionList; All Ok!
I have this ListBox (ComboBox) on GWT : final ListBox category_2=new ListBox(); category_2.setStyleName(article_combo); category_2.addItem(----------,
I have this issue with ComboBox that uses IEnumerable<Brush> as ItemsSource; the problem lies
I have a view with a ComboBox like this <ComboBox Name=cmbPurpose DisplayMemberPath=@value SelectedValuePath=@key ItemsSource={Binding
I have some Company names as Items in a ComboBox like this: 123 SomeCompany
I have a ComboBox with a label function like this one: private function fieldLabelFunction(item:Object):String
I have a ComboBox bound to a collection of objects defined as this. public
So I was have a combobox like below, coded like this; AllowsTransparency=True Background=Transparent> <Border
This is what I'm talking about: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx basically I want to have a drop
I have this code that adjusts the width of a comboBox drop-down: private void

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.