Results 1 to 6 of 6

Thread: [RESOLVED] Datagridview Data Type

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2012
    Location
    Port Douglas Australia
    Posts
    17

    Resolved [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

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jan 2012
    Location
    Port Douglas Australia
    Posts
    17

    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.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Datagridview Data Type

    Please use the Thread Tools menu to mark your thread Resolved.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Junior Member
    Join Date
    Sep 2012
    Posts
    30

    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?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Datagridview Data Type

    [QUOTE=Larry Hinklestein;4404643]
    Quote Originally Posted by jrb01 View Post
    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?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    Junior Member
    Join Date
    Sep 2012
    Posts
    30

    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
  •  



Click Here to Expand Forum to Full Width