|
-
Jan 17th, 2012, 03:43 AM
#1
Thread Starter
Junior Member
[RESOLVED] Datagridview Data Type
When i generate a datagridview from my data set on form1 (via design) it returns data type as decimal which is correct. But when i generate the same datagridview from the same data set as in form1 on a new form (form2) it returns data as an integer. I have specified in my data set data type as system.decimal , why does it not obey this on form2 , only form1. I am new to vb sorry if it has an obvious answer or i am missing something basic. Thanks
-
Jan 17th, 2012, 06:24 PM
#2
Thread Starter
Junior Member
Re: Datagridview Data Type
I have solved this problem myself.
It is not a data type problem. Sorry for the confusion.
I fully set up my database thru design mode and should of paid more attention to each default value setting of each column.
It is more a problem with the default value set for SCALE in the database table setup.
The default value is set to zero. So all numeric data is returned with no decimal places.
To change the scale of the numeric data values in the columns property .
Is as follows
Open Database Explorer
>select database file
>select tables
>right click over database file (just under the table)
>select "edit table schema"
>click the affected column name
>change the scale setting ( the number represents the number of decimal places)
Hope if any one else who is new to vb finds this useful, and solves their problem. All of my learning thru vb has been via this process of Google searches, trial and error , and reading forums like this one. Thank-you.
-
Jan 17th, 2012, 10:49 PM
#3
Re: Datagridview Data Type
Please use the Thread Tools menu to mark your thread Resolved.
-
Apr 30th, 2013, 10:40 PM
#4
Junior Member
Re: Datagridview Data Type
[QUOTE=jrb01;4119743]I have solved this problem myself.
>select database file
>select tables
>right click over database file (just under the table)
>select "edit table schema"
>click the affected column name
>change the scale setting ( the number represents the number of decimal places)
QUOTE]
I tried to do this, it's grayed out and I can't change it. What do I have to do?
-
Apr 30th, 2013, 11:37 PM
#5
Re: Datagridview Data Type
[QUOTE=Larry Hinklestein;4404643]
 Originally Posted by jrb01
I have solved this problem myself.
>select database file
>select tables
>right click over database file (just under the table)
>select "edit table schema"
>click the affected column name
>change the scale setting ( the number represents the number of decimal places)
QUOTE]
I tried to do this, it's grayed out and I can't change it. What do I have to do?
What version of VS are you using (2010, 2012, etc)? What edition (Express, Ultimate, etc)? What database are you using and what version and edition is it? Can you show us a screen shot of your Database/Server Explorer?
-
Apr 30th, 2013, 11:57 PM
#6
Junior Member
Re: Datagridview Data Type
Visual Basic 2010 express, using the built-in Service Database. Turns out what you have to do is right-click the table, select Open Table Definition (it's not called Edit Schema anymore) and a column properties box will open up underneath the table, I kept trying to change it in the properties box off to the right. Live and learn. Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|