Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am getting value from table column at that time i want to convert that value into float value
C#
Object s=table.getModel().getValueAt(i, 3);
      Object s1=table.getModel().getValueAt(i, 5);


C#
int j = Integer.valueOf((String) s);
        int j1 = Integer.valueOf((String) s1);


how can i convert object value into float value i can tried but getting error cast exception
Posted
Updated 21-Mar-14 21:46pm
v2
Comments
Richard MacCutchan 22-Mar-14 5:37am    
What is the type of the object that you are getting in the first instance (table.getModel().getValueAt(i, 5))?
baliram bhande 22-Mar-14 7:33am    
it is a float type of data

1 solution

C#
String str = (String) table.getModel().getValueAt(i, 3);
                String str1 = (String) table.getModel().getValueAt(i, 5);


C#
System.out.println("object is " + Float.valueOf(str));
                    System.out.println("object is1 " + Float.valueOf(str1));
                    Float a,c;
                    a=Float.valueOf(str);
                    c=Float.valueOf(str1);olve error
 
Share this answer
 

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