473,395 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

when i try to convert a value member to int32 says wrong data type

9
Expand|Select|Wrap|Line Numbers
  1. String empID = cmbEmp.ValueMember.ToString();
  2. int empIDint = Convert.ToInt16(empID);
  3.  
This`s the error i get "Input string was not in a correct format."
"when converting a string to date time, parse the string to take the date before putting each variable into the datetime object....."

guyz i dont understand what to do now...
Dec 15 '10 #1
4 2296
EARNEST
128 100+
Try this

Expand|Select|Wrap|Line Numbers
  1. int empIDint = Int32.Parse(cmbEmp.ValueMember.ToString());
hope it helps
Dec 15 '10 #2
isitha
9
thnx EARNEST....i think da problem is with my database table....bt still i cudn`t get it resolved....thnx agn
Dec 15 '10 #3
Christian Binder
218 Expert 100+
Normally ValueMember is the name of the field/column, the values of the ComboBox are bound. I think you want to use the value of the currently selected item, so try
Expand|Select|Wrap|Line Numbers
  1. int empIDint = Convert.ToInt16(cmbEmp.SelectedValue);
  2.  
Dec 15 '10 #4
isitha
9
thnx CHRISTIAN it worked pretty well n i ve made some changes to my DB also......hav a gud day..
Dec 15 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: japh | last post by:
I am on chapter 7 of my C++ text (sigh). Could you help me understand this? If the user inputs an int, the script works as it should. If they enter a char instead, it goes into an endless loop. ...
3
by: Jeff | last post by:
Hello I need help with a problem I have homework for a larger program than shown below but the code below effectively shows the problem whem compiled and executed. Basically, I want to be...
6
by: leo | last post by:
Hello there Im having trouble in storing blank or space value on a variable wich data type is Date/Time, if i make a statement like this Field Data Type...
1
by: deko | last post by:
Okay, so I figured out how to pull Outlook Appointments into an Access Table (see below). But the data comes in the wrong Data Type - how do I convert it from Text to Long Integer? For...
0
by: Scott Jasperse | last post by:
I have created a Web Service using visual studio that returns a custom stongly-typed collection that I created to contain a custom class. In order for the collection class to work, it must have a...
2
by: x | last post by:
hi i am a pilot by profession. i want to create a database of my logbook using ms access 2002. i am facing a problem regarding the format of time field. when i select "Data/Time" data type for my...
2
by: empire5 | last post by:
I'm trying to convert a MS-Sql 6.5 VB application to SQL 2005 and vb.net. The vb app has uses a variant data type. When I try to read the variant data type from the sql 2005 database I get 8,000...
1
jamesd0142
by: jamesd0142 | last post by:
sql server 2000 declare @a varchar(20) Set @a = (select CONVERT(CHAR(10),GETDATE(),103)) update Users SET = DD3_Password, PasswordChanged = @a from temptable2 where Users.Login =...
1
by: will1 | last post by:
Hi, I have searched for several days to try to resolve my little problem.Sorry but I have very little experience with JavaScript OOP. I have a form which consists of at least one line. Each...
1
by: kimsengora | last post by:
Ex. I need to fill in values argument Field1 is text Field2 is image Insert into tbl1 values("'+val1+"','+val2+'") val2 is image like...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.