Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i did Populate the Listbox with Username and checklistbox with formsNames.

when user click the 2 or 3 forms than this must save into table.


when i was saving the data to the table for the Paticluar Field

userId is integer type.
but i dont how to do??
i m getting the error input string was not correct format
plz tell me how to insert data into the table

objvo.UserId = Convert.ToInt32(UserListBox.SelectedValue.ToString());

Thanks for advance
Posted
Comments
dimpledevani 23-Jul-12 9:02am    
what is data's datatype of your listbox??
sadhana4 23-Jul-12 9:06am    
UserListBox.DisplayMember = "UserName";
UserListBox.ValueMember = "UserId";
UserListBox.DataSource = dt;
UserName is string
dimpledevani 23-Jul-12 9:08am    
Have you debugged on the line objvo.UserId = Convert.ToInt32(UserListBox.SelectedValue.ToString());
and saw if the UserListBox.SelectedValue contains anything
sadhana4 23-Jul-12 9:09am    
yes it contain the name of user Janki
dimpledevani 23-Jul-12 9:11am    
It contained the name of user and not its UserID??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900